LLVM: lib/Transforms/Utils/LoopSimplify.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

71using namespace llvm;

72

73#define DEBUG_TYPE "loop-simplify"

74

75STATISTIC(NumNested , "Number of nested loops split out");

76

77

78

79

83

86 return;

87

88

89

90

91

92

93

97 if (++BBI != NewBB->getParent()->end() && L->contains(&*BBI)) {

98 FoundBB = Pred;

99 break;

100 }

101 }

102

103

104

105

106 if (!FoundBB)

107 FoundBB = SplitPreds[0];

109}

110

111

112

113

114

117 bool PreserveLCSSA) {

119

120

123 if (!L->contains(P)) {

124

125

126

128 return nullptr;

129

130

132 }

133 }

134

135

138 LI, MSSAU, PreserveLCSSA);

139 if (!PreheaderBB)

140 return nullptr;

141

142 LLVM_DEBUG(dbgs() << "LoopSimplify: Creating pre-header "

143 << PreheaderBB->getName() << "\n");

144

145

146

148

149 return PreheaderBB;

150}

151

152

153

154

159 do {

161 if (Blocks.insert(BB).second && BB != StopBlock)

162

163

165 } while (!Worklist.empty());

166}

167

168

169

172 const DataLayout &DL = L->getHeader()->getDataLayout();

175 ++I;

177

180 continue;

181 }

182

183

187

188 return PN;

189 }

190 return nullptr;

191}

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

216

217 if (!Preheader)

218 return nullptr;

219

220

221

222

223

224

225

226

227

228

229

230

231 for (auto *BB : L->blocks()) {

232 for (auto &II : *BB) {

234 if (CI->isConvergent()) {

235 return nullptr;

236 }

237 }

238 }

239 }

240

241

243 assert(!Header->isEHPad() && "Can't insert backedge to EH pad");

244

246 if (!PN) return nullptr;

247

248

249

250

255

257 return nullptr;

259 }

260 }

261 LLVM_DEBUG(dbgs() << "LoopSimplify: Splitting out a new outer loop\n");

262

263

264

265

266 if (SE)

268

270 DT, LI, MSSAU, PreserveLCSSA);

271

272

273

275

276

278

279

280 if (Loop *Parent = L->getParentLoop())

282 else

284

285

287

290

291

292

293 L->moveToHeader(Header);

294

295

296

301 }

302

303

304

305 const std::vector<Loop*> &SubLoops = L->getSubLoops();

306 for (size_t I = 0; I != SubLoops.size(); )

307 if (BlocksInL.count(SubLoops[I]->getHeader()))

308 ++I;

309 else

310 NewOuter->addChildLoop(L->removeChildLoop(SubLoops.begin() + I));

311

313 OuterLoopBlocks.push_back(NewBB);

314

315

316 for (unsigned i = 0; i != L->getBlocks().size(); ++i) {

318 if (!BlocksInL.count(BB)) {

319

320 L->removeBlockFromLoop(BB);

321 if ((*LI)[BB] == L) {

324 }

325 --i;

326 }

327 }

328

329

330

332

333 if (PreserveLCSSA) {

334

335

336

337

338

339

341

343 "LCSSA is broken after separating nested loops!");

344 }

345

346 return NewOuter;

347}

348

349

350

351

352

353

354

358 assert(L->getNumBackEdges() > 1 && "Must have > 1 backedge!");

359

360

362 Function *F = Header->getParent();

363

364

365 if (!Preheader)

366 return nullptr;

367

368

369 assert(!Header->isEHPad() && "Can't insert backedge to EH pad");

370

371

372 std::vector<BasicBlock*> BackedgeBlocks;

374

376 return nullptr;

377

378 if (P != Preheader) BackedgeBlocks.push_back(P);

379 }

380

381

383 Header->getName() + ".backedge", F);

385 BETerminator->setDebugLoc(Header->getFirstNonPHIIt()->getDebugLoc());

386

387 LLVM_DEBUG(dbgs() << "LoopSimplify: Inserting unique backedge block "

388 << BEBlock->getName() << "\n");

389

390

391 Function::iterator InsertPos = ++BackedgeBlocks.back()->getIterator();

393

394

395

400

401

402

403 unsigned PreheaderIdx = ~0U;

404 bool HasUniqueIncomingValue = true;

405 Value *UniqueValue = nullptr;

409 if (IBB == Preheader) {

410 PreheaderIdx = i;

411 } else {

413 if (HasUniqueIncomingValue) {

414 if (!UniqueValue)

415 UniqueValue = IV;

416 else if (UniqueValue != IV)

417 HasUniqueIncomingValue = false;

418 }

419 }

420 }

421

422

423 assert(PreheaderIdx != ~0U && "PHI has no preheader entry??");

424 if (PreheaderIdx != 0) {

427 }

428

430 false);

431

432

434

435

436

437

438 if (HasUniqueIncomingValue) {

441 }

442 }

443

444

445

446

447

448 MDNode *LoopMD = nullptr;

449 for (BasicBlock *BB : BackedgeBlocks) {

451 if (!LoopMD)

452 LoopMD = TI->getMetadata(LLVMContext::MD_loop);

453 TI->setMetadata(LLVMContext::MD_loop, nullptr);

455 }

457

458

459

460

461

462 L->addBasicBlockToLoop(BEBlock, *LI);

463

464

466

467 if (MSSAU)

469 BEBlock);

470

471 return BEBlock;

472}

473

474

482

483ReprocessLoop:

484

485

486

487

488

490 if (BB == L->getHeader())

491 continue;

492

495 if (!L->contains(P))

497

498

500

501 LLVM_DEBUG(dbgs() << "LoopSimplify: Deleting edge from dead predecessor "

502 << P->getName() << "\n");

503

504

507 nullptr, MSSAU);

509 }

510 }

511

514

515

516

517

519 L->getExitingBlocks(ExitingBlocks);

520 for (BasicBlock *ExitingBlock : ExitingBlocks)

522 if (BI->isConditional()) {

524

526 << "LoopSimplify: Resolving \"br i1 undef\" to exit in "

527 << ExitingBlock->getName() << "\n");

528

529 BI->setCondition(ConstantInt::get(Cond->getType(),

530 !L->contains(BI->getSuccessor(0))));

531

533 }

534 }

535

536

537 BasicBlock *Preheader = L->getLoopPreheader();

538 if (!Preheader) {

540 if (Preheader)

542 }

543

544

545

546

547

550

553

554

555

556 BasicBlock *LoopLatch = L->getLoopLatch();

557 if (!LoopLatch) {

558

559

560

561 if (L->getNumBackEdges() < 8) {

563 PreserveLCSSA, AC, MSSAU)) {

564 ++NumNested;

565

566

568

569

571

572

573 goto ReprocessLoop;

574 }

575 }

576

577

578

579

581 if (LoopLatch)

583 }

584

587

588 const DataLayout &DL = L->getHeader()->getDataLayout();

589

590

591

592

602 }

603 }

604

605

606

607

608

609

610

611

612

613

614 auto HasUniqueExitBlock = [&]() {

616 for (auto *ExitingBB : ExitingBlocks)

617 for (auto *SuccBB : successors(ExitingBB)) {

618 if (L->contains(SuccBB))

619 continue;

620

621 if (!UniqueExit)

622 UniqueExit = SuccBB;

623 else if (UniqueExit != SuccBB)

624 return false;

625 }

626

627 return true;

628 };

629 if (HasUniqueExitBlock()) {

630 for (BasicBlock *ExitingBlock : ExitingBlocks) {

631 if (!ExitingBlock->getSinglePredecessor()) continue;

635 if (!CI || CI->getParent() != ExitingBlock) continue;

636

637

638

639 bool AllInvariant = true;

640 bool AnyInvariant = false;

641 for (auto I = ExitingBlock->instructionsWithoutDebug().begin(); &*I != BI; ) {

643 if (Inst == CI)

644 continue;

645 if (!L->makeLoopInvariant(

646 Inst, AnyInvariant,

647 Preheader ? Preheader->getTerminator() : nullptr, MSSAU, SE)) {

648 AllInvariant = false;

649 break;

650 }

651 }

652 if (AnyInvariant)

654 if (!AllInvariant) continue;

655

656

657

658

660 continue;

661

662

663

664 LLVM_DEBUG(dbgs() << "LoopSimplify: Eliminating exiting block "

665 << ExitingBlock->getName() << "\n");

666

670

672 while (Node->isLeaf()) {

675 }

677 if (MSSAU) {

679 ExitBlockSet.insert(ExitingBlock);

681 }

682

684 ExitingBlock, PreserveLCSSA);

686 ExitingBlock, PreserveLCSSA);

687 ExitingBlock->eraseFromParent();

688 }

689 }

690

693

695}

696

701

702#ifndef NDEBUG

703

704

705 if (PreserveLCSSA) {

706 assert(DT && "DT not available.");

707 assert(LI && "LI not available.");

708 assert(L->isRecursivelyLCSSAForm(*DT, *LI) &&

709 "Requested to preserve LCSSA, but it's already broken.");

710 }

711#endif

712

713

716

717

718

719

720 for (unsigned Idx = 0; Idx != Worklist.size(); ++Idx) {

721 Loop *L2 = Worklist[Idx];

723 }

724

725 while (!Worklist.empty())

727 AC, MSSAU, PreserveLCSSA);

728

729

730

731

732

735

737}

738

739namespace {

741 static char ID;

744 }

745

747

748 void getAnalysisUsage(AnalysisUsage &AU) const override {

749 AU.addRequired();

750

751

752 AU.addRequired();

754

757

761 AU.addPreserved();

765 AU.addPreserved();

767 }

768

769

770 void verifyAnalysis() const override;

771};

772}

773

774char LoopSimplify::ID = 0;

776 "Canonicalize natural loops", false, false)

782

783

786

787

788

789

790bool LoopSimplify::runOnFunction(Function &F) {

792 LoopInfo *LI = &getAnalysis().getLoopInfo();

793 DominatorTree *DT = &getAnalysis().getDomTree();

794 auto *SEWP = getAnalysisIfAvailable();

797 &getAnalysis().getAssumptionCache(F);

799 std::unique_ptr MSSAU;

800 auto *MSSAAnalysis = getAnalysisIfAvailable();

801 if (MSSAAnalysis) {

802 MSSA = &MSSAAnalysis->getMSSA();

803 MSSAU = std::make_unique(MSSA);

804 }

805

806 bool PreserveLCSSA = mustPreserveAnalysisID(LCSSAID);

807

808

809 for (auto *L : *LI)

811

812#ifndef NDEBUG

813 if (PreserveLCSSA) {

814 bool InLCSSA = all_of(

815 *LI, [&](Loop *L) { return L->isRecursivelyLCSSAForm(*DT, *LI); });

816 assert(InLCSSA && "LCSSA is broken after loop-simplify.");

817 }

818#endif

820}

821

830 std::unique_ptr MSSAU;

831 if (MSSAAnalysis) {

832 auto *MSSA = &MSSAAnalysis->getMSSA();

833 MSSAU = std::make_unique(MSSA);

834 }

835

836

837

838

839 for (auto *L : *LI)

841 simplifyLoop(L, DT, LI, SE, AC, MSSAU.get(), false);

842

845

850 if (MSSAAnalysis)

852

853

854

855

856

858 return PA;

859}

860

861

862

863#if 0

864static void verifyLoop(Loop *L) {

865

867 verifyLoop(*I);

868

869

870

871

872

873

874

875 if (!L->getLoopPreheader() || !L->getLoopLatch()) {

876 bool HasIndBrPred = false;

879 HasIndBrPred = true;

880 break;

881 }

882 assert(HasIndBrPred &&

883 "LoopSimplify has no excuse for missing loop header info!");

884 (void)HasIndBrPred;

885 }

886

887

888 if (L->hasDedicatedExits()) {

889 bool HasIndBrExiting = false;

890 SmallVector<BasicBlock*, 8> ExitingBlocks;

891 L->getExitingBlocks(ExitingBlocks);

892 for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {

894 HasIndBrExiting = true;

895 break;

896 }

897 }

898

899 assert(HasIndBrExiting &&

900 "LoopSimplify has no excuse for missing exit block info!");

901 (void)HasIndBrExiting;

902 }

903}

904#endif

905

906void LoopSimplify::verifyAnalysis() const {

907

908

909

910

911#if 0

912 for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I)

913 verifyLoop(*I);

914#endif

915}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

This is the interface for LLVM's primary stateless and local alias analysis.

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

This file contains the declarations for the subclasses of Constant, which represent the different fla...

static bool runOnFunction(Function &F, bool PostInlining)

This is the interface for a simple mod/ref and alias analysis over globals.

This file provides various utilities for inspecting and working with the control flow graph in LLVM I...

Module.h This file contains the declarations for the Module class.

static void placeSplitBlockCarefully(BasicBlock *NewBB, SmallVectorImpl< BasicBlock * > &SplitPreds, Loop *L)

Definition LoopSimplify.cpp:80

static PHINode * findPHIToPartitionLoops(Loop *L, DominatorTree *DT, AssumptionCache *AC)

The first part of loop-nestification is to find a PHI node that tells us how to partition the loops.

Definition LoopSimplify.cpp:170

static void addBlockAndPredsToSet(BasicBlock *InputBB, BasicBlock *StopBlock, SmallPtrSetImpl< BasicBlock * > &Blocks)

Add the specified block, and all of its predecessors, to the specified set, if it's not already in th...

Definition LoopSimplify.cpp:155

static bool simplifyOneLoop(Loop *L, SmallVectorImpl< Loop * > &Worklist, DominatorTree *DT, LoopInfo *LI, ScalarEvolution *SE, AssumptionCache *AC, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)

Simplify one loop and queue further loops for simplification.

Definition LoopSimplify.cpp:475

static Loop * separateNestedLoop(Loop *L, BasicBlock *Preheader, DominatorTree *DT, LoopInfo *LI, ScalarEvolution *SE, bool PreserveLCSSA, AssumptionCache *AC, MemorySSAUpdater *MSSAU)

If this loop has multiple backedges, try to pull one of them out into a nested loop.

Definition LoopSimplify.cpp:212

static BasicBlock * insertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU)

This method is called when the specified loop has more than one backedge in it.

Definition LoopSimplify.cpp:355

This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...

uint64_t IntrinsicInst * II

#define INITIALIZE_PASS_DEPENDENCY(depName)

#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)

#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)

const SmallVectorImpl< MachineOperand > & Cond

This is the interface for a SCEV-based alias analysis.

This file implements a set that has insertion order iteration characteristics.

This file defines the SmallVector class.

This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...

#define STATISTIC(VARNAME, DESC)

static const uint32_t IV[8]

PassT::Result * getCachedResult(IRUnitT &IR) const

Get the cached result of an analysis pass for a given IR unit.

PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)

Get the result of an analysis pass for a given IR unit.

AnalysisUsage & addPreservedID(const void *ID)

AnalysisUsage & addRequired()

AnalysisUsage & addPreserved()

Add the specified Pass class to the set of analyses preserved by this pass.

A function analysis which provides an AssumptionCache.

An immutable pass that tracks lazily created AssumptionCache objects.

A cache of @llvm.assume calls within a function.

LLVM Basic Block Representation.

const Function * getParent() const

Return the enclosing method, or null if none.

static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)

Creates a new BasicBlock.

LLVM_ABI void moveAfter(BasicBlock *MovePos)

Unlink this basic block from its current function and insert it right after MovePos in the function M...

InstListType::iterator iterator

Instruction iterators...

const Instruction * getTerminator() const LLVM_READONLY

Returns the terminator instruction if the block is well formed or null if the block is not well forme...

LLVM_ABI void removePredecessor(BasicBlock *Pred, bool KeepOneInputPHIs=false)

Update PHI nodes in this BasicBlock before removal of predecessor Pred.

Conditional or Unconditional Branch instruction.

bool isConditional() const

static BranchInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)

BasicBlock * getSuccessor(unsigned i) const

Value * getCondition() const

Analysis pass which computes BranchProbabilityInfo.

This class is the base class for the comparison instructions.

A parsed version of the target data layout string in and methods for querying it.

Analysis pass which computes a DominatorTree.

void changeImmediateDominator(DomTreeNodeBase< NodeT > *N, DomTreeNodeBase< NodeT > *NewIDom)

changeImmediateDominator - This method is used to update the dominator tree information when a node's...

void splitBlock(NodeT *NewBB)

splitBlock - BB is split and now it has one successor.

void eraseNode(NodeT *BB)

eraseNode - Removes a node from the dominator tree.

DomTreeNodeBase< NodeT > * getNode(const NodeT *BB) const

getNode - return the (Post)DominatorTree node for the specified basic block.

Legacy analysis pass which computes a DominatorTree.

Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.

LLVM_ABI bool dominates(const BasicBlock *BB, const Use &U) const

Return true if the (end of the) basic block BB dominates the use U.

FunctionPass class - This class is used to implement most global optimizations.

BasicBlockListType::iterator iterator

LLVM_ABI InstListType::iterator eraseFromParent()

This method unlinks 'this' from the containing basic block and deletes it.

LLVM_ABI void replaceSuccessorWith(BasicBlock *OldBB, BasicBlock *NewBB)

Replace specified successor OldBB to point at the provided block.

MDNode * getMetadata(unsigned KindID) const

Get the metadata of given kind attached to this Instruction.

LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node)

Set the metadata of the specified kind to the specified node.

void setDebugLoc(DebugLoc Loc)

Set the debug location information for this instruction.

Analysis pass that exposes the LoopInfo for a function.

typename std::vector< Loop * >::const_iterator iterator

void addChildLoop(LoopT *NewChild)

Add the specified loop to be a child of this loop.

void addBlockEntry(BlockT *BB)

This adds a basic block directly to the basic block list.

void replaceChildLoopWith(LoopT *OldChild, LoopT *NewChild)

This is used when splitting loops up.

void changeTopLevelLoop(LoopT *OldLoop, LoopT *NewLoop)

Replace the specified loop in the top-level loops list with the indicated loop.

void removeBlock(BlockT *BB)

This method completely removes BB from all data structures, including all of the Loop objects it is n...

LoopT * AllocateLoop(ArgsTy &&...Args)

void changeLoopFor(BlockT *BB, LoopT *L)

Change the top-level loop that contains BB to the specified loop.

The legacy pass manager's analysis pass to compute loop information.

bool replacementPreservesLCSSAForm(Instruction *From, Value *To)

Returns true if replacing From with To everywhere is guaranteed to preserve LCSSA form.

LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)

Definition LoopSimplify.cpp:822

Represents a single loop in the control flow graph.

bool isRecursivelyLCSSAForm(const DominatorTree &DT, const LoopInfo &LI, bool IgnoreTokens=true) const

Return true if this Loop and all inner subloops are in LCSSA form.

An analysis that produces MemorySSA for a function.

MemorySSA * getMemorySSA() const

Get handle on MemorySSA.

LLVM_ABI void updatePhisWhenInsertingUniqueBackedgeBlock(BasicBlock *LoopHeader, BasicBlock *LoopPreheader, BasicBlock *BackedgeBlock)

Update MemorySSA when inserting a unique backedge block for a loop.

LLVM_ABI void removeBlocks(const SmallSetVector< BasicBlock *, 8 > &DeadBlocks)

Remove all MemoryAcceses in a set of BasicBlocks about to be deleted.

Encapsulates MemorySSA, including all data associated with memory accesses.

LLVM_ABI void verifyMemorySSA(VerificationLevel=VerificationLevel::Fast) const

Verify that MemorySSA is self consistent (IE definitions dominate all uses, uses appear in the right ...

void addIncoming(Value *V, BasicBlock *BB)

Add an incoming value to the end of the PHI list.

LLVM_ABI void removeIncomingValueIf(function_ref< bool(unsigned)> Predicate, bool DeletePHIIfEmpty=true)

Remove all incoming values for which the predicate returns true.

void setIncomingBlock(unsigned i, BasicBlock *BB)

void setIncomingValue(unsigned i, Value *V)

BasicBlock * getIncomingBlock(unsigned i) const

Return incoming basic block number i.

Value * getIncomingValue(unsigned i) const

Return incoming value number x.

unsigned getNumIncomingValues() const

Return the number of incoming edges.

static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)

Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...

static LLVM_ABI PassRegistry * getPassRegistry()

getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...

Pass interface - Implemented by all 'passes'.

A set of analyses that are preserved following a run of a transformation pass.

static PreservedAnalyses all()

Construct a special preserved set that preserves all passes.

PreservedAnalyses & preserve()

Mark an analysis as preserved.

Analysis pass that exposes the ScalarEvolution for a function.

The main scalar evolution driver.

LLVM_ABI void forgetLoop(const Loop *L)

This method should be called by the client when it has changed a loop in a way that may effect Scalar...

LLVM_ABI void forgetTopmostLoop(const Loop *L)

LLVM_ABI void forgetValue(Value *V)

This method should be called by the client when it has changed a value in a way that may effect its v...

bool insert(const value_type &X)

Insert a new element into the SetVector.

A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...

size_type count(ConstPtrType Ptr) const

count - Return 1 if the specified pointer is in the set, 0 otherwise.

std::pair< iterator, bool > insert(PtrType Ptr)

Inserts Ptr if and only if there is no element in the container equal to Ptr.

SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.

A SetVector that performs no allocations if smaller than a certain size.

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

void append(ItTy in_start, ItTy in_end)

Add the specified range to the end of the SmallVector.

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

'undef' values are things that do not have specified contents.

LLVM Value Representation.

Type * getType() const

All values are typed, get the type of this value.

LLVM_ABI void replaceAllUsesWith(Value *V)

Change all uses of this to point to a new Value.

LLVM_ABI StringRef getName() const

Return a constant reference to the value's name.

const ParentTy * getParent() const

self_iterator getIterator()

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

LLVM_ABI Instruction * getTerminator() const

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, ScalarEvolution *SE, AssumptionCache *AC, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)

Simplify each loop in a loop nest recursively.

Definition LoopSimplify.cpp:697

LLVM_ABI BasicBlock * InsertPreheaderForLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)

InsertPreheaderForLoop - Once we discover that a loop doesn't have a preheader, this method is called...

Definition LoopSimplify.cpp:115

bool all_of(R &&range, UnaryPredicate P)

Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

LLVM_ABI void initializeLoopSimplifyPass(PassRegistry &)

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

auto successors(const MachineBasicBlock *BB)

void append_range(Container &C, Range &&R)

Wrapper function to append range R to container C.

LLVM_ABI char & LoopSimplifyID

Definition LoopSimplify.cpp:784

LLVM_ABI Value * simplifyInstruction(Instruction *I, const SimplifyQuery &Q)

See if we can compute a simplified version of this instruction.

DomTreeNodeBase< BasicBlock > DomTreeNode

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

LLVM_ABI char & BreakCriticalEdgesID

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

LLVM_ABI unsigned changeToUnreachable(Instruction *I, bool PreserveLCSSA=false, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)

Insert an unreachable instruction before the specified instruction, making it and the rest of the cod...

LLVM_ABI BasicBlock * SplitBlockPredecessors(BasicBlock *BB, ArrayRef< BasicBlock * > Preds, const char *Suffix, DominatorTree *DT, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr, bool PreserveLCSSA=false)

This method introduces at least one new basic block into the function and moves some of the predecess...

LLVM_ABI bool VerifyMemorySSA

Enables verification of MemorySSA.

LLVM_ABI bool formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI, MemorySSAUpdater *MSSAU, bool PreserveLCSSA)

Ensure that all exit blocks of the loop are dedicated exits.

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

auto predecessors(const MachineBasicBlock *BB)

bool is_contained(R &&Range, const E &Element)

Returns true if Element is found in Range.

LLVM_ABI bool foldBranchToCommonDest(BranchInst *BI, llvm::DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr, const TargetTransformInfo *TTI=nullptr, unsigned BonusInstThreshold=1)

If this basic block is ONLY a setcc and a branch, and if a predecessor branches to us and one of our ...

bool pred_empty(const BasicBlock *BB)

AnalysisManager< Function > FunctionAnalysisManager

Convenience typedef for the Function analysis manager.

LLVM_ABI bool formLCSSA(Loop &L, const DominatorTree &DT, const LoopInfo *LI, ScalarEvolution *SE)

Put loop into LCSSA form.

LLVM_ABI Pass * createLoopSimplifyPass()

Definition LoopSimplify.cpp:785