1 //===- LoopInfo.cpp - Natural Loop Calculator -----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the LoopInfo class that is used to identify natural loops
11 // and determine the loop depth of various nodes of the CFG. Note that the
12 // loops identified may actually be several natural loops that share the same
13 // header node... not just a single natural loop.
15 //===----------------------------------------------------------------------===//
17 #include "llvm/Analysis/LoopInfo.h"
18 #include "llvm/ADT/DepthFirstIterator.h"
19 #include "llvm/ADT/SmallPtrSet.h"
20 #include "llvm/Analysis/LoopInfoImpl.h"
21 #include "llvm/Analysis/LoopIterator.h"
22 #include "llvm/Analysis/ValueTracking.h"
23 #include "llvm/IR/Constants.h"
24 #include "llvm/IR/Dominators.h"
25 #include "llvm/IR/Instructions.h"
26 #include "llvm/IR/Metadata.h"
27 #include "llvm/Support/CFG.h"
28 #include "llvm/Support/CommandLine.h"
29 #include "llvm/Support/Debug.h"
33 // Explicitly instantiate methods in LoopInfoImpl.h for IR-level Loops.
34 template class llvm::LoopBase<BasicBlock, Loop>;
35 template class llvm::LoopInfoBase<BasicBlock, Loop>;
37 // Always verify loopinfo if expensive checking is enabled.
39 static bool VerifyLoopInfo = true;
41 static bool VerifyLoopInfo = false;
43 static cl::opt<bool,true>
44 VerifyLoopInfoX("verify-loop-info", cl::location(VerifyLoopInfo),
45 cl::desc("Verify loop info (time consuming)"));
47 char LoopInfo::ID = 0;
48 INITIALIZE_PASS_BEGIN(LoopInfo, "loops", "Natural Loop Information", true, true)
49 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
50 INITIALIZE_PASS_END(LoopInfo, "loops", "Natural Loop Information", true, true)
52 // Loop identifier metadata name.
53 static const char *const LoopMDName = "llvm.loop";
55 //===----------------------------------------------------------------------===//
56 // Loop implementation
59 /// isLoopInvariant - Return true if the specified value is loop invariant
61 bool Loop::isLoopInvariant(Value *V) const {
62 if (Instruction *I = dyn_cast<Instruction>(V))
64 return true; // All non-instructions are loop invariant
67 /// hasLoopInvariantOperands - Return true if all the operands of the
68 /// specified instruction are loop invariant.
69 bool Loop::hasLoopInvariantOperands(Instruction *I) const {
70 for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
71 if (!isLoopInvariant(I->getOperand(i)))
77 /// makeLoopInvariant - If the given value is an instruciton inside of the
78 /// loop and it can be hoisted, do so to make it trivially loop-invariant.
79 /// Return true if the value after any hoisting is loop invariant. This
80 /// function can be used as a slightly more aggressive replacement for
83 /// If InsertPt is specified, it is the point to hoist instructions to.
84 /// If null, the terminator of the loop preheader is used.
86 bool Loop::makeLoopInvariant(Value *V, bool &Changed,
87 Instruction *InsertPt) const {
88 if (Instruction *I = dyn_cast<Instruction>(V))
89 return makeLoopInvariant(I, Changed, InsertPt);
90 return true; // All non-instructions are loop-invariant.
93 /// makeLoopInvariant - If the given instruction is inside of the
94 /// loop and it can be hoisted, do so to make it trivially loop-invariant.
95 /// Return true if the instruction after any hoisting is loop invariant. This
96 /// function can be used as a slightly more aggressive replacement for
99 /// If InsertPt is specified, it is the point to hoist instructions to.
100 /// If null, the terminator of the loop preheader is used.
102 bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
103 Instruction *InsertPt) const {
104 // Test if the value is already loop-invariant.
105 if (isLoopInvariant(I))
107 if (!isSafeToSpeculativelyExecute(I))
109 if (I->mayReadFromMemory())
111 // The landingpad instruction is immobile.
112 if (isa<LandingPadInst>(I))
114 // Determine the insertion point, unless one was given.
116 BasicBlock *Preheader = getLoopPreheader();
117 // Without a preheader, hoisting is not feasible.
120 InsertPt = Preheader->getTerminator();
122 // Don't hoist instructions with loop-variant operands.
123 for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
124 if (!makeLoopInvariant(I->getOperand(i), Changed, InsertPt))
128 I->moveBefore(InsertPt);
133 /// getCanonicalInductionVariable - Check to see if the loop has a canonical
134 /// induction variable: an integer recurrence that starts at 0 and increments
135 /// by one each time through the loop. If so, return the phi node that
136 /// corresponds to it.
138 /// The IndVarSimplify pass transforms loops to have a canonical induction
141 PHINode *Loop::getCanonicalInductionVariable() const {
142 BasicBlock *H = getHeader();
144 BasicBlock *Incoming = 0, *Backedge = 0;
145 pred_iterator PI = pred_begin(H);
146 assert(PI != pred_end(H) &&
147 "Loop must have at least one backedge!");
149 if (PI == pred_end(H)) return 0; // dead loop
151 if (PI != pred_end(H)) return 0; // multiple backedges?
153 if (contains(Incoming)) {
154 if (contains(Backedge))
156 std::swap(Incoming, Backedge);
157 } else if (!contains(Backedge))
160 // Loop over all of the PHI nodes, looking for a canonical indvar.
161 for (BasicBlock::iterator I = H->begin(); isa<PHINode>(I); ++I) {
162 PHINode *PN = cast<PHINode>(I);
163 if (ConstantInt *CI =
164 dyn_cast<ConstantInt>(PN->getIncomingValueForBlock(Incoming)))
165 if (CI->isNullValue())
166 if (Instruction *Inc =
167 dyn_cast<Instruction>(PN->getIncomingValueForBlock(Backedge)))
168 if (Inc->getOpcode() == Instruction::Add &&
169 Inc->getOperand(0) == PN)
170 if (ConstantInt *CI = dyn_cast<ConstantInt>(Inc->getOperand(1)))
171 if (CI->equalsInt(1))
177 /// isLCSSAForm - Return true if the Loop is in LCSSA form
178 bool Loop::isLCSSAForm(DominatorTree &DT) const {
179 for (block_iterator BI = block_begin(), E = block_end(); BI != E; ++BI) {
180 BasicBlock *BB = *BI;
181 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;++I)
182 for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;
185 BasicBlock *UserBB = cast<Instruction>(U)->getParent();
186 if (PHINode *P = dyn_cast<PHINode>(U))
187 UserBB = P->getIncomingBlock(UI);
189 // Check the current block, as a fast-path, before checking whether
190 // the use is anywhere in the loop. Most values are used in the same
191 // block they are defined in. Also, blocks not reachable from the
192 // entry are special; uses in them don't need to go through PHIs.
195 DT.isReachableFromEntry(UserBB))
203 /// isLoopSimplifyForm - Return true if the Loop is in the form that
204 /// the LoopSimplify form transforms loops to, which is sometimes called
206 bool Loop::isLoopSimplifyForm() const {
207 // Normal-form loops have a preheader, a single backedge, and all of their
208 // exits have all their predecessors inside the loop.
209 return getLoopPreheader() && getLoopLatch() && hasDedicatedExits();
212 /// isSafeToClone - Return true if the loop body is safe to clone in practice.
213 /// Routines that reform the loop CFG and split edges often fail on indirectbr.
214 bool Loop::isSafeToClone() const {
215 // Return false if any loop blocks contain indirectbrs, or there are any calls
216 // to noduplicate functions.
217 for (Loop::block_iterator I = block_begin(), E = block_end(); I != E; ++I) {
218 if (isa<IndirectBrInst>((*I)->getTerminator()))
221 if (const InvokeInst *II = dyn_cast<InvokeInst>((*I)->getTerminator()))
222 if (II->hasFnAttr(Attribute::NoDuplicate))
225 for (BasicBlock::iterator BI = (*I)->begin(), BE = (*I)->end(); BI != BE; ++BI) {
226 if (const CallInst *CI = dyn_cast<CallInst>(BI)) {
227 if (CI->hasFnAttr(Attribute::NoDuplicate))
235 MDNode *Loop::getLoopID() const {
237 if (isLoopSimplifyForm()) {
238 LoopID = getLoopLatch()->getTerminator()->getMetadata(LoopMDName);
240 // Go through each predecessor of the loop header and check the
241 // terminator for the metadata.
242 BasicBlock *H = getHeader();
243 for (block_iterator I = block_begin(), IE = block_end(); I != IE; ++I) {
244 TerminatorInst *TI = (*I)->getTerminator();
247 // Check if this terminator branches to the loop header.
248 for (unsigned i = 0, ie = TI->getNumSuccessors(); i != ie; ++i) {
249 if (TI->getSuccessor(i) == H) {
250 MD = TI->getMetadata(LoopMDName);
259 else if (MD != LoopID)
263 if (!LoopID || LoopID->getNumOperands() == 0 ||
264 LoopID->getOperand(0) != LoopID)
269 void Loop::setLoopID(MDNode *LoopID) const {
270 assert(LoopID && "Loop ID should not be null");
271 assert(LoopID->getNumOperands() > 0 && "Loop ID needs at least one operand");
272 assert(LoopID->getOperand(0) == LoopID && "Loop ID should refer to itself");
274 if (isLoopSimplifyForm()) {
275 getLoopLatch()->getTerminator()->setMetadata(LoopMDName, LoopID);
279 BasicBlock *H = getHeader();
280 for (block_iterator I = block_begin(), IE = block_end(); I != IE; ++I) {
281 TerminatorInst *TI = (*I)->getTerminator();
282 for (unsigned i = 0, ie = TI->getNumSuccessors(); i != ie; ++i) {
283 if (TI->getSuccessor(i) == H)
284 TI->setMetadata(LoopMDName, LoopID);
289 bool Loop::isAnnotatedParallel() const {
290 MDNode *desiredLoopIdMetadata = getLoopID();
292 if (!desiredLoopIdMetadata)
295 // The loop branch contains the parallel loop metadata. In order to ensure
296 // that any parallel-loop-unaware optimization pass hasn't added loop-carried
297 // dependencies (thus converted the loop back to a sequential loop), check
298 // that all the memory instructions in the loop contain parallelism metadata
299 // that point to the same unique "loop id metadata" the loop branch does.
300 for (block_iterator BB = block_begin(), BE = block_end(); BB != BE; ++BB) {
301 for (BasicBlock::iterator II = (*BB)->begin(), EE = (*BB)->end();
304 if (!II->mayReadOrWriteMemory())
307 // The memory instruction can refer to the loop identifier metadata
308 // directly or indirectly through another list metadata (in case of
309 // nested parallel loops). The loop identifier metadata refers to
310 // itself so we can check both cases with the same routine.
311 MDNode *loopIdMD = II->getMetadata("llvm.mem.parallel_loop_access");
316 bool loopIdMDFound = false;
317 for (unsigned i = 0, e = loopIdMD->getNumOperands(); i < e; ++i) {
318 if (loopIdMD->getOperand(i) == desiredLoopIdMetadata) {
319 loopIdMDFound = true;
332 /// hasDedicatedExits - Return true if no exit block for the loop
333 /// has a predecessor that is outside the loop.
334 bool Loop::hasDedicatedExits() const {
335 // Each predecessor of each exit block of a normal loop is contained
337 SmallVector<BasicBlock *, 4> ExitBlocks;
338 getExitBlocks(ExitBlocks);
339 for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i)
340 for (pred_iterator PI = pred_begin(ExitBlocks[i]),
341 PE = pred_end(ExitBlocks[i]); PI != PE; ++PI)
344 // All the requirements are met.
348 /// getUniqueExitBlocks - Return all unique successor blocks of this loop.
349 /// These are the blocks _outside of the current loop_ which are branched to.
350 /// This assumes that loop exits are in canonical form.
353 Loop::getUniqueExitBlocks(SmallVectorImpl<BasicBlock *> &ExitBlocks) const {
354 assert(hasDedicatedExits() &&
355 "getUniqueExitBlocks assumes the loop has canonical form exits!");
357 SmallVector<BasicBlock *, 32> switchExitBlocks;
359 for (block_iterator BI = block_begin(), BE = block_end(); BI != BE; ++BI) {
361 BasicBlock *current = *BI;
362 switchExitBlocks.clear();
364 for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I) {
365 // If block is inside the loop then it is not a exit block.
369 pred_iterator PI = pred_begin(*I);
370 BasicBlock *firstPred = *PI;
372 // If current basic block is this exit block's first predecessor
373 // then only insert exit block in to the output ExitBlocks vector.
374 // This ensures that same exit block is not inserted twice into
375 // ExitBlocks vector.
376 if (current != firstPred)
379 // If a terminator has more then two successors, for example SwitchInst,
380 // then it is possible that there are multiple edges from current block
381 // to one exit block.
382 if (std::distance(succ_begin(current), succ_end(current)) <= 2) {
383 ExitBlocks.push_back(*I);
387 // In case of multiple edges from current block to exit block, collect
388 // only one edge in ExitBlocks. Use switchExitBlocks to keep track of
390 if (std::find(switchExitBlocks.begin(), switchExitBlocks.end(), *I)
391 == switchExitBlocks.end()) {
392 switchExitBlocks.push_back(*I);
393 ExitBlocks.push_back(*I);
399 /// getUniqueExitBlock - If getUniqueExitBlocks would return exactly one
400 /// block, return that block. Otherwise return null.
401 BasicBlock *Loop::getUniqueExitBlock() const {
402 SmallVector<BasicBlock *, 8> UniqueExitBlocks;
403 getUniqueExitBlocks(UniqueExitBlocks);
404 if (UniqueExitBlocks.size() == 1)
405 return UniqueExitBlocks[0];
409 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
410 void Loop::dump() const {
415 //===----------------------------------------------------------------------===//
416 // UnloopUpdater implementation
420 /// Find the new parent loop for all blocks within the "unloop" whose last
421 /// backedges has just been removed.
422 class UnloopUpdater {
428 // Map unloop's immediate subloops to their nearest reachable parents. Nested
429 // loops within these subloops will not change parents. However, an immediate
430 // subloop's new parent will be the nearest loop reachable from either its own
431 // exits *or* any of its nested loop's exits.
432 DenseMap<Loop*, Loop*> SubloopParents;
434 // Flag the presence of an irreducible backedge whose destination is a block
435 // directly contained by the original unloop.
439 UnloopUpdater(Loop *UL, LoopInfo *LInfo) :
440 Unloop(UL), LI(LInfo), DFS(UL), FoundIB(false) {}
442 void updateBlockParents();
444 void removeBlocksFromAncestors();
446 void updateSubloopParents();
449 Loop *getNearestLoop(BasicBlock *BB, Loop *BBLoop);
451 } // end anonymous namespace
453 /// updateBlockParents - Update the parent loop for all blocks that are directly
454 /// contained within the original "unloop".
455 void UnloopUpdater::updateBlockParents() {
456 if (Unloop->getNumBlocks()) {
457 // Perform a post order CFG traversal of all blocks within this loop,
458 // propagating the nearest loop from sucessors to predecessors.
459 LoopBlocksTraversal Traversal(DFS, LI);
460 for (LoopBlocksTraversal::POTIterator POI = Traversal.begin(),
461 POE = Traversal.end(); POI != POE; ++POI) {
463 Loop *L = LI->getLoopFor(*POI);
464 Loop *NL = getNearestLoop(*POI, L);
467 // For reducible loops, NL is now an ancestor of Unloop.
468 assert((NL != Unloop && (!NL || NL->contains(Unloop))) &&
469 "uninitialized successor");
470 LI->changeLoopFor(*POI, NL);
473 // Or the current block is part of a subloop, in which case its parent
475 assert((FoundIB || Unloop->contains(L)) && "uninitialized successor");
479 // Each irreducible loop within the unloop induces a round of iteration using
480 // the DFS result cached by Traversal.
481 bool Changed = FoundIB;
482 for (unsigned NIters = 0; Changed; ++NIters) {
483 assert(NIters < Unloop->getNumBlocks() && "runaway iterative algorithm");
485 // Iterate over the postorder list of blocks, propagating the nearest loop
486 // from successors to predecessors as before.
488 for (LoopBlocksDFS::POIterator POI = DFS.beginPostorder(),
489 POE = DFS.endPostorder(); POI != POE; ++POI) {
491 Loop *L = LI->getLoopFor(*POI);
492 Loop *NL = getNearestLoop(*POI, L);
494 assert(NL != Unloop && (!NL || NL->contains(Unloop)) &&
495 "uninitialized successor");
496 LI->changeLoopFor(*POI, NL);
503 /// removeBlocksFromAncestors - Remove unloop's blocks from all ancestors below
504 /// their new parents.
505 void UnloopUpdater::removeBlocksFromAncestors() {
506 // Remove all unloop's blocks (including those in nested subloops) from
507 // ancestors below the new parent loop.
508 for (Loop::block_iterator BI = Unloop->block_begin(),
509 BE = Unloop->block_end(); BI != BE; ++BI) {
510 Loop *OuterParent = LI->getLoopFor(*BI);
511 if (Unloop->contains(OuterParent)) {
512 while (OuterParent->getParentLoop() != Unloop)
513 OuterParent = OuterParent->getParentLoop();
514 OuterParent = SubloopParents[OuterParent];
516 // Remove blocks from former Ancestors except Unloop itself which will be
518 for (Loop *OldParent = Unloop->getParentLoop(); OldParent != OuterParent;
519 OldParent = OldParent->getParentLoop()) {
520 assert(OldParent && "new loop is not an ancestor of the original");
521 OldParent->removeBlockFromLoop(*BI);
526 /// updateSubloopParents - Update the parent loop for all subloops directly
527 /// nested within unloop.
528 void UnloopUpdater::updateSubloopParents() {
529 while (!Unloop->empty()) {
530 Loop *Subloop = *llvm::prior(Unloop->end());
531 Unloop->removeChildLoop(llvm::prior(Unloop->end()));
533 assert(SubloopParents.count(Subloop) && "DFS failed to visit subloop");
534 if (Loop *Parent = SubloopParents[Subloop])
535 Parent->addChildLoop(Subloop);
537 LI->addTopLevelLoop(Subloop);
541 /// getNearestLoop - Return the nearest parent loop among this block's
542 /// successors. If a successor is a subloop header, consider its parent to be
543 /// the nearest parent of the subloop's exits.
545 /// For subloop blocks, simply update SubloopParents and return NULL.
546 Loop *UnloopUpdater::getNearestLoop(BasicBlock *BB, Loop *BBLoop) {
548 // Initially for blocks directly contained by Unloop, NearLoop == Unloop and
549 // is considered uninitialized.
550 Loop *NearLoop = BBLoop;
553 if (NearLoop != Unloop && Unloop->contains(NearLoop)) {
555 // Find the subloop ancestor that is directly contained within Unloop.
556 while (Subloop->getParentLoop() != Unloop) {
557 Subloop = Subloop->getParentLoop();
558 assert(Subloop && "subloop is not an ancestor of the original loop");
560 // Get the current nearest parent of the Subloop exits, initially Unloop.
562 SubloopParents.insert(std::make_pair(Subloop, Unloop)).first->second;
565 succ_iterator I = succ_begin(BB), E = succ_end(BB);
567 assert(!Subloop && "subloop blocks must have a successor");
568 NearLoop = 0; // unloop blocks may now exit the function.
570 for (; I != E; ++I) {
572 continue; // self loops are uninteresting
574 Loop *L = LI->getLoopFor(*I);
576 // This successor has not been processed. This path must lead to an
577 // irreducible backedge.
578 assert((FoundIB || !DFS.hasPostorder(*I)) && "should have seen IB");
581 if (L != Unloop && Unloop->contains(L)) {
582 // Successor is in a subloop.
584 continue; // Branching within subloops. Ignore it.
586 // BB branches from the original into a subloop header.
587 assert(L->getParentLoop() == Unloop && "cannot skip into nested loops");
589 // Get the current nearest parent of the Subloop's exits.
590 L = SubloopParents[L];
591 // L could be Unloop if the only exit was an irreducible backedge.
596 // Handle critical edges from Unloop into a sibling loop.
597 if (L && !L->contains(Unloop)) {
598 L = L->getParentLoop();
600 // Remember the nearest parent loop among successors or subloop exits.
601 if (NearLoop == Unloop || !NearLoop || NearLoop->contains(L))
605 SubloopParents[Subloop] = NearLoop;
611 //===----------------------------------------------------------------------===//
612 // LoopInfo implementation
614 bool LoopInfo::runOnFunction(Function &) {
616 LI.Analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
620 /// updateUnloop - The last backedge has been removed from a loop--now the
621 /// "unloop". Find a new parent for the blocks contained within unloop and
622 /// update the loop tree. We don't necessarily have valid dominators at this
623 /// point, but LoopInfo is still valid except for the removal of this loop.
625 /// Note that Unloop may now be an empty loop. Calling Loop::getHeader without
626 /// checking first is illegal.
627 void LoopInfo::updateUnloop(Loop *Unloop) {
629 // First handle the special case of no parent loop to simplify the algorithm.
630 if (!Unloop->getParentLoop()) {
631 // Since BBLoop had no parent, Unloop blocks are no longer in a loop.
632 for (Loop::block_iterator I = Unloop->block_begin(),
633 E = Unloop->block_end(); I != E; ++I) {
635 // Don't reparent blocks in subloops.
636 if (getLoopFor(*I) != Unloop)
639 // Blocks no longer have a parent but are still referenced by Unloop until
640 // the Unloop object is deleted.
641 LI.changeLoopFor(*I, 0);
644 // Remove the loop from the top-level LoopInfo object.
645 for (LoopInfo::iterator I = LI.begin();; ++I) {
646 assert(I != LI.end() && "Couldn't find loop");
653 // Move all of the subloops to the top-level.
654 while (!Unloop->empty())
655 LI.addTopLevelLoop(Unloop->removeChildLoop(llvm::prior(Unloop->end())));
660 // Update the parent loop for all blocks within the loop. Blocks within
661 // subloops will not change parents.
662 UnloopUpdater Updater(Unloop, this);
663 Updater.updateBlockParents();
665 // Remove blocks from former ancestor loops.
666 Updater.removeBlocksFromAncestors();
668 // Add direct subloops as children in their new parent loop.
669 Updater.updateSubloopParents();
671 // Remove unloop from its parent loop.
672 Loop *ParentLoop = Unloop->getParentLoop();
673 for (Loop::iterator I = ParentLoop->begin();; ++I) {
674 assert(I != ParentLoop->end() && "Couldn't find loop");
676 ParentLoop->removeChildLoop(I);
682 void LoopInfo::verifyAnalysis() const {
683 // LoopInfo is a FunctionPass, but verifying every loop in the function
684 // each time verifyAnalysis is called is very expensive. The
685 // -verify-loop-info option can enable this. In order to perform some
686 // checking by default, LoopPass has been taught to call verifyLoop
687 // manually during loop pass sequences.
689 if (!VerifyLoopInfo) return;
691 DenseSet<const Loop*> Loops;
692 for (iterator I = begin(), E = end(); I != E; ++I) {
693 assert(!(*I)->getParentLoop() && "Top-level loop has a parent!");
694 (*I)->verifyLoopNest(&Loops);
697 // Verify that blocks are mapped to valid loops.
698 for (DenseMap<BasicBlock*, Loop*>::const_iterator I = LI.BBMap.begin(),
699 E = LI.BBMap.end(); I != E; ++I) {
700 assert(Loops.count(I->second) && "orphaned loop");
701 assert(I->second->contains(I->first) && "orphaned block");
705 void LoopInfo::getAnalysisUsage(AnalysisUsage &AU) const {
706 AU.setPreservesAll();
707 AU.addRequired<DominatorTreeWrapperPass>();
710 void LoopInfo::print(raw_ostream &OS, const Module*) const {
714 //===----------------------------------------------------------------------===//
715 // LoopBlocksDFS implementation
718 /// Traverse the loop blocks and store the DFS result.
719 /// Useful for clients that just want the final DFS result and don't need to
720 /// visit blocks during the initial traversal.
721 void LoopBlocksDFS::perform(LoopInfo *LI) {
722 LoopBlocksTraversal Traversal(*this, LI);
723 for (LoopBlocksTraversal::POTIterator POI = Traversal.begin(),
724 POE = Traversal.end(); POI != POE; ++POI) ;