LLVM API Documentation

LoopUnroll.cpp
Go to the documentation of this file.
00001 //===-- UnrollLoop.cpp - Loop unrolling utilities -------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements some loop unrolling utilities. It does not define any
00011 // actual pass or policy, but provides a single function to perform loop
00012 // unrolling.
00013 //
00014 // The process of unrolling can produce extraneous basic blocks linked with
00015 // unconditional branches.  This will be corrected in the future.
00016 //
00017 //===----------------------------------------------------------------------===//
00018 
00019 #include "llvm/Transforms/Utils/UnrollLoop.h"
00020 #include "llvm/ADT/SmallPtrSet.h"
00021 #include "llvm/ADT/Statistic.h"
00022 #include "llvm/Analysis/AssumptionTracker.h"
00023 #include "llvm/Analysis/InstructionSimplify.h"
00024 #include "llvm/Analysis/LoopIterator.h"
00025 #include "llvm/Analysis/LoopPass.h"
00026 #include "llvm/Analysis/ScalarEvolution.h"
00027 #include "llvm/IR/BasicBlock.h"
00028 #include "llvm/IR/DataLayout.h"
00029 #include "llvm/IR/Dominators.h"
00030 #include "llvm/IR/DiagnosticInfo.h"
00031 #include "llvm/IR/LLVMContext.h"
00032 #include "llvm/Support/Debug.h"
00033 #include "llvm/Support/raw_ostream.h"
00034 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
00035 #include "llvm/Transforms/Utils/Cloning.h"
00036 #include "llvm/Transforms/Utils/Local.h"
00037 #include "llvm/Transforms/Utils/LoopUtils.h"
00038 #include "llvm/Transforms/Utils/SimplifyIndVar.h"
00039 using namespace llvm;
00040 
00041 #define DEBUG_TYPE "loop-unroll"
00042 
00043 // TODO: Should these be here or in LoopUnroll?
00044 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
00045 STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)");
00046 
00047 /// RemapInstruction - Convert the instruction operands from referencing the
00048 /// current values into those specified by VMap.
00049 static inline void RemapInstruction(Instruction *I,
00050                                     ValueToValueMapTy &VMap) {
00051   for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
00052     Value *Op = I->getOperand(op);
00053     ValueToValueMapTy::iterator It = VMap.find(Op);
00054     if (It != VMap.end())
00055       I->setOperand(op, It->second);
00056   }
00057 
00058   if (PHINode *PN = dyn_cast<PHINode>(I)) {
00059     for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
00060       ValueToValueMapTy::iterator It = VMap.find(PN->getIncomingBlock(i));
00061       if (It != VMap.end())
00062         PN->setIncomingBlock(i, cast<BasicBlock>(It->second));
00063     }
00064   }
00065 }
00066 
00067 /// FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it
00068 /// only has one predecessor, and that predecessor only has one successor.
00069 /// The LoopInfo Analysis that is passed will be kept consistent.  If folding is
00070 /// successful references to the containing loop must be removed from
00071 /// ScalarEvolution by calling ScalarEvolution::forgetLoop because SE may have
00072 /// references to the eliminated BB.  The argument ForgottenLoops contains a set
00073 /// of loops that have already been forgotten to prevent redundant, expensive
00074 /// calls to ScalarEvolution::forgetLoop.  Returns the new combined block.
00075 static BasicBlock *
00076 FoldBlockIntoPredecessor(BasicBlock *BB, LoopInfo* LI, LPPassManager *LPM,
00077                          SmallPtrSetImpl<Loop *> &ForgottenLoops) {
00078   // Merge basic blocks into their predecessor if there is only one distinct
00079   // pred, and if there is only one distinct successor of the predecessor, and
00080   // if there are no PHI nodes.
00081   BasicBlock *OnlyPred = BB->getSinglePredecessor();
00082   if (!OnlyPred) return nullptr;
00083 
00084   if (OnlyPred->getTerminator()->getNumSuccessors() != 1)
00085     return nullptr;
00086 
00087   DEBUG(dbgs() << "Merging: " << *BB << "into: " << *OnlyPred);
00088 
00089   // Resolve any PHI nodes at the start of the block.  They are all
00090   // guaranteed to have exactly one entry if they exist, unless there are
00091   // multiple duplicate (but guaranteed to be equal) entries for the
00092   // incoming edges.  This occurs when there are multiple edges from
00093   // OnlyPred to OnlySucc.
00094   FoldSingleEntryPHINodes(BB);
00095 
00096   // Delete the unconditional branch from the predecessor...
00097   OnlyPred->getInstList().pop_back();
00098 
00099   // Make all PHI nodes that referred to BB now refer to Pred as their
00100   // source...
00101   BB->replaceAllUsesWith(OnlyPred);
00102 
00103   // Move all definitions in the successor to the predecessor...
00104   OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
00105 
00106   // OldName will be valid until erased.
00107   StringRef OldName = BB->getName();
00108 
00109   // Erase basic block from the function...
00110 
00111   // ScalarEvolution holds references to loop exit blocks.
00112   if (LPM) {
00113     if (ScalarEvolution *SE = LPM->getAnalysisIfAvailable<ScalarEvolution>()) {
00114       if (Loop *L = LI->getLoopFor(BB)) {
00115         if (ForgottenLoops.insert(L))
00116           SE->forgetLoop(L);
00117       }
00118     }
00119   }
00120   LI->removeBlock(BB);
00121 
00122   // Inherit predecessor's name if it exists...
00123   if (!OldName.empty() && !OnlyPred->hasName())
00124     OnlyPred->setName(OldName);
00125 
00126   BB->eraseFromParent();
00127 
00128   return OnlyPred;
00129 }
00130 
00131 /// Unroll the given loop by Count. The loop must be in LCSSA form. Returns true
00132 /// if unrolling was successful, or false if the loop was unmodified. Unrolling
00133 /// can only fail when the loop's latch block is not terminated by a conditional
00134 /// branch instruction. However, if the trip count (and multiple) are not known,
00135 /// loop unrolling will mostly produce more code that is no faster.
00136 ///
00137 /// TripCount is generally defined as the number of times the loop header
00138 /// executes. UnrollLoop relaxes the definition to permit early exits: here
00139 /// TripCount is the iteration on which control exits LatchBlock if no early
00140 /// exits were taken. Note that UnrollLoop assumes that the loop counter test
00141 /// terminates LatchBlock in order to remove unnecesssary instances of the
00142 /// test. In other words, control may exit the loop prior to TripCount
00143 /// iterations via an early branch, but control may not exit the loop from the
00144 /// LatchBlock's terminator prior to TripCount iterations.
00145 ///
00146 /// Similarly, TripMultiple divides the number of times that the LatchBlock may
00147 /// execute without exiting the loop.
00148 ///
00149 /// The LoopInfo Analysis that is passed will be kept consistent.
00150 ///
00151 /// If a LoopPassManager is passed in, and the loop is fully removed, it will be
00152 /// removed from the LoopPassManager as well. LPM can also be NULL.
00153 ///
00154 /// This utility preserves LoopInfo. If DominatorTree or ScalarEvolution are
00155 /// available from the Pass it must also preserve those analyses.
00156 bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
00157                       bool AllowRuntime, unsigned TripMultiple,
00158                       LoopInfo *LI, Pass *PP, LPPassManager *LPM,
00159                       AssumptionTracker *AT) {
00160   BasicBlock *Preheader = L->getLoopPreheader();
00161   if (!Preheader) {
00162     DEBUG(dbgs() << "  Can't unroll; loop preheader-insertion failed.\n");
00163     return false;
00164   }
00165 
00166   BasicBlock *LatchBlock = L->getLoopLatch();
00167   if (!LatchBlock) {
00168     DEBUG(dbgs() << "  Can't unroll; loop exit-block-insertion failed.\n");
00169     return false;
00170   }
00171 
00172   // Loops with indirectbr cannot be cloned.
00173   if (!L->isSafeToClone()) {
00174     DEBUG(dbgs() << "  Can't unroll; Loop body cannot be cloned.\n");
00175     return false;
00176   }
00177 
00178   BasicBlock *Header = L->getHeader();
00179   BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
00180 
00181   if (!BI || BI->isUnconditional()) {
00182     // The loop-rotate pass can be helpful to avoid this in many cases.
00183     DEBUG(dbgs() <<
00184              "  Can't unroll; loop not terminated by a conditional branch.\n");
00185     return false;
00186   }
00187 
00188   if (Header->hasAddressTaken()) {
00189     // The loop-rotate pass can be helpful to avoid this in many cases.
00190     DEBUG(dbgs() <<
00191           "  Won't unroll loop: address of header block is taken.\n");
00192     return false;
00193   }
00194 
00195   if (TripCount != 0)
00196     DEBUG(dbgs() << "  Trip Count = " << TripCount << "\n");
00197   if (TripMultiple != 1)
00198     DEBUG(dbgs() << "  Trip Multiple = " << TripMultiple << "\n");
00199 
00200   // Effectively "DCE" unrolled iterations that are beyond the tripcount
00201   // and will never be executed.
00202   if (TripCount != 0 && Count > TripCount)
00203     Count = TripCount;
00204 
00205   // Don't enter the unroll code if there is nothing to do. This way we don't
00206   // need to support "partial unrolling by 1".
00207   if (TripCount == 0 && Count < 2)
00208     return false;
00209 
00210   assert(Count > 0);
00211   assert(TripMultiple > 0);
00212   assert(TripCount == 0 || TripCount % TripMultiple == 0);
00213 
00214   // Are we eliminating the loop control altogether?
00215   bool CompletelyUnroll = Count == TripCount;
00216 
00217   // We assume a run-time trip count if the compiler cannot
00218   // figure out the loop trip count and the unroll-runtime
00219   // flag is specified.
00220   bool RuntimeTripCount = (TripCount == 0 && Count > 0 && AllowRuntime);
00221 
00222   if (RuntimeTripCount && !UnrollRuntimeLoopProlog(L, Count, LI, LPM))
00223     return false;
00224 
00225   // Notify ScalarEvolution that the loop will be substantially changed,
00226   // if not outright eliminated.
00227   if (PP) {
00228     ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00229     if (SE)
00230       SE->forgetLoop(L);
00231   }
00232 
00233   // If we know the trip count, we know the multiple...
00234   unsigned BreakoutTrip = 0;
00235   if (TripCount != 0) {
00236     BreakoutTrip = TripCount % Count;
00237     TripMultiple = 0;
00238   } else {
00239     // Figure out what multiple to use.
00240     BreakoutTrip = TripMultiple =
00241       (unsigned)GreatestCommonDivisor64(Count, TripMultiple);
00242   }
00243 
00244   // Report the unrolling decision.
00245   DebugLoc LoopLoc = L->getStartLoc();
00246   Function *F = Header->getParent();
00247   LLVMContext &Ctx = F->getContext();
00248 
00249   if (CompletelyUnroll) {
00250     DEBUG(dbgs() << "COMPLETELY UNROLLING loop %" << Header->getName()
00251           << " with trip count " << TripCount << "!\n");
00252     emitOptimizationRemark(Ctx, DEBUG_TYPE, *F, LoopLoc,
00253                            Twine("completely unrolled loop with ") +
00254                                Twine(TripCount) + " iterations");
00255   } else {
00256     auto EmitDiag = [&](const Twine &T) {
00257       emitOptimizationRemark(Ctx, DEBUG_TYPE, *F, LoopLoc,
00258                              "unrolled loop by a factor of " + Twine(Count) +
00259                                  T);
00260     };
00261 
00262     DEBUG(dbgs() << "UNROLLING loop %" << Header->getName()
00263           << " by " << Count);
00264     if (TripMultiple == 0 || BreakoutTrip != TripMultiple) {
00265       DEBUG(dbgs() << " with a breakout at trip " << BreakoutTrip);
00266       EmitDiag(" with a breakout at trip " + Twine(BreakoutTrip));
00267     } else if (TripMultiple != 1) {
00268       DEBUG(dbgs() << " with " << TripMultiple << " trips per branch");
00269       EmitDiag(" with " + Twine(TripMultiple) + " trips per branch");
00270     } else if (RuntimeTripCount) {
00271       DEBUG(dbgs() << " with run-time trip count");
00272       EmitDiag(" with run-time trip count");
00273     }
00274     DEBUG(dbgs() << "!\n");
00275   }
00276 
00277   bool ContinueOnTrue = L->contains(BI->getSuccessor(0));
00278   BasicBlock *LoopExit = BI->getSuccessor(ContinueOnTrue);
00279 
00280   // For the first iteration of the loop, we should use the precloned values for
00281   // PHI nodes.  Insert associations now.
00282   ValueToValueMapTy LastValueMap;
00283   std::vector<PHINode*> OrigPHINode;
00284   for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
00285     OrigPHINode.push_back(cast<PHINode>(I));
00286   }
00287 
00288   std::vector<BasicBlock*> Headers;
00289   std::vector<BasicBlock*> Latches;
00290   Headers.push_back(Header);
00291   Latches.push_back(LatchBlock);
00292 
00293   // The current on-the-fly SSA update requires blocks to be processed in
00294   // reverse postorder so that LastValueMap contains the correct value at each
00295   // exit.
00296   LoopBlocksDFS DFS(L);
00297   DFS.perform(LI);
00298 
00299   // Stash the DFS iterators before adding blocks to the loop.
00300   LoopBlocksDFS::RPOIterator BlockBegin = DFS.beginRPO();
00301   LoopBlocksDFS::RPOIterator BlockEnd = DFS.endRPO();
00302 
00303   for (unsigned It = 1; It != Count; ++It) {
00304     std::vector<BasicBlock*> NewBlocks;
00305 
00306     for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) {
00307       ValueToValueMapTy VMap;
00308       BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It));
00309       Header->getParent()->getBasicBlockList().push_back(New);
00310 
00311       // Loop over all of the PHI nodes in the block, changing them to use the
00312       // incoming values from the previous block.
00313       if (*BB == Header)
00314         for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
00315           PHINode *NewPHI = cast<PHINode>(VMap[OrigPHINode[i]]);
00316           Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock);
00317           if (Instruction *InValI = dyn_cast<Instruction>(InVal))
00318             if (It > 1 && L->contains(InValI))
00319               InVal = LastValueMap[InValI];
00320           VMap[OrigPHINode[i]] = InVal;
00321           New->getInstList().erase(NewPHI);
00322         }
00323 
00324       // Update our running map of newest clones
00325       LastValueMap[*BB] = New;
00326       for (ValueToValueMapTy::iterator VI = VMap.begin(), VE = VMap.end();
00327            VI != VE; ++VI)
00328         LastValueMap[VI->first] = VI->second;
00329 
00330       L->addBasicBlockToLoop(New, LI->getBase());
00331 
00332       // Add phi entries for newly created values to all exit blocks.
00333       for (succ_iterator SI = succ_begin(*BB), SE = succ_end(*BB);
00334            SI != SE; ++SI) {
00335         if (L->contains(*SI))
00336           continue;
00337         for (BasicBlock::iterator BBI = (*SI)->begin();
00338              PHINode *phi = dyn_cast<PHINode>(BBI); ++BBI) {
00339           Value *Incoming = phi->getIncomingValueForBlock(*BB);
00340           ValueToValueMapTy::iterator It = LastValueMap.find(Incoming);
00341           if (It != LastValueMap.end())
00342             Incoming = It->second;
00343           phi->addIncoming(Incoming, New);
00344         }
00345       }
00346       // Keep track of new headers and latches as we create them, so that
00347       // we can insert the proper branches later.
00348       if (*BB == Header)
00349         Headers.push_back(New);
00350       if (*BB == LatchBlock)
00351         Latches.push_back(New);
00352 
00353       NewBlocks.push_back(New);
00354     }
00355 
00356     // Remap all instructions in the most recent iteration
00357     for (unsigned i = 0; i < NewBlocks.size(); ++i)
00358       for (BasicBlock::iterator I = NewBlocks[i]->begin(),
00359            E = NewBlocks[i]->end(); I != E; ++I)
00360         ::RemapInstruction(I, LastValueMap);
00361   }
00362 
00363   // Loop over the PHI nodes in the original block, setting incoming values.
00364   for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
00365     PHINode *PN = OrigPHINode[i];
00366     if (CompletelyUnroll) {
00367       PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader));
00368       Header->getInstList().erase(PN);
00369     }
00370     else if (Count > 1) {
00371       Value *InVal = PN->removeIncomingValue(LatchBlock, false);
00372       // If this value was defined in the loop, take the value defined by the
00373       // last iteration of the loop.
00374       if (Instruction *InValI = dyn_cast<Instruction>(InVal)) {
00375         if (L->contains(InValI))
00376           InVal = LastValueMap[InVal];
00377       }
00378       assert(Latches.back() == LastValueMap[LatchBlock] && "bad last latch");
00379       PN->addIncoming(InVal, Latches.back());
00380     }
00381   }
00382 
00383   // Now that all the basic blocks for the unrolled iterations are in place,
00384   // set up the branches to connect them.
00385   for (unsigned i = 0, e = Latches.size(); i != e; ++i) {
00386     // The original branch was replicated in each unrolled iteration.
00387     BranchInst *Term = cast<BranchInst>(Latches[i]->getTerminator());
00388 
00389     // The branch destination.
00390     unsigned j = (i + 1) % e;
00391     BasicBlock *Dest = Headers[j];
00392     bool NeedConditional = true;
00393 
00394     if (RuntimeTripCount && j != 0) {
00395       NeedConditional = false;
00396     }
00397 
00398     // For a complete unroll, make the last iteration end with a branch
00399     // to the exit block.
00400     if (CompletelyUnroll && j == 0) {
00401       Dest = LoopExit;
00402       NeedConditional = false;
00403     }
00404 
00405     // If we know the trip count or a multiple of it, we can safely use an
00406     // unconditional branch for some iterations.
00407     if (j != BreakoutTrip && (TripMultiple == 0 || j % TripMultiple != 0)) {
00408       NeedConditional = false;
00409     }
00410 
00411     if (NeedConditional) {
00412       // Update the conditional branch's successor for the following
00413       // iteration.
00414       Term->setSuccessor(!ContinueOnTrue, Dest);
00415     } else {
00416       // Remove phi operands at this loop exit
00417       if (Dest != LoopExit) {
00418         BasicBlock *BB = Latches[i];
00419         for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB);
00420              SI != SE; ++SI) {
00421           if (*SI == Headers[i])
00422             continue;
00423           for (BasicBlock::iterator BBI = (*SI)->begin();
00424                PHINode *Phi = dyn_cast<PHINode>(BBI); ++BBI) {
00425             Phi->removeIncomingValue(BB, false);
00426           }
00427         }
00428       }
00429       // Replace the conditional branch with an unconditional one.
00430       BranchInst::Create(Dest, Term);
00431       Term->eraseFromParent();
00432     }
00433   }
00434 
00435   // Merge adjacent basic blocks, if possible.
00436   SmallPtrSet<Loop *, 4> ForgottenLoops;
00437   for (unsigned i = 0, e = Latches.size(); i != e; ++i) {
00438     BranchInst *Term = cast<BranchInst>(Latches[i]->getTerminator());
00439     if (Term->isUnconditional()) {
00440       BasicBlock *Dest = Term->getSuccessor(0);
00441       if (BasicBlock *Fold = FoldBlockIntoPredecessor(Dest, LI, LPM,
00442                                                       ForgottenLoops))
00443         std::replace(Latches.begin(), Latches.end(), Dest, Fold);
00444     }
00445   }
00446 
00447   // FIXME: We could register any cloned assumptions instead of clearing the
00448   // whole function's cache.
00449   AT->forgetCachedAssumptions(F);
00450 
00451   DominatorTree *DT = nullptr;
00452   if (PP) {
00453     // FIXME: Reconstruct dom info, because it is not preserved properly.
00454     // Incrementally updating domtree after loop unrolling would be easy.
00455     if (DominatorTreeWrapperPass *DTWP =
00456             PP->getAnalysisIfAvailable<DominatorTreeWrapperPass>()) {
00457       DT = &DTWP->getDomTree();
00458       DT->recalculate(*L->getHeader()->getParent());
00459     }
00460 
00461     // Simplify any new induction variables in the partially unrolled loop.
00462     ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00463     if (SE && !CompletelyUnroll) {
00464       SmallVector<WeakVH, 16> DeadInsts;
00465       simplifyLoopIVs(L, SE, LPM, DeadInsts);
00466 
00467       // Aggressively clean up dead instructions that simplifyLoopIVs already
00468       // identified. Any remaining should be cleaned up below.
00469       while (!DeadInsts.empty())
00470         if (Instruction *Inst =
00471             dyn_cast_or_null<Instruction>(&*DeadInsts.pop_back_val()))
00472           RecursivelyDeleteTriviallyDeadInstructions(Inst);
00473     }
00474   }
00475   // At this point, the code is well formed.  We now do a quick sweep over the
00476   // inserted code, doing constant propagation and dead code elimination as we
00477   // go.
00478   const std::vector<BasicBlock*> &NewLoopBlocks = L->getBlocks();
00479   for (std::vector<BasicBlock*>::const_iterator BB = NewLoopBlocks.begin(),
00480        BBE = NewLoopBlocks.end(); BB != BBE; ++BB)
00481     for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) {
00482       Instruction *Inst = I++;
00483 
00484       if (isInstructionTriviallyDead(Inst))
00485         (*BB)->getInstList().erase(Inst);
00486       else if (Value *V = SimplifyInstruction(Inst))
00487         if (LI->replacementPreservesLCSSAForm(Inst, V)) {
00488           Inst->replaceAllUsesWith(V);
00489           (*BB)->getInstList().erase(Inst);
00490         }
00491     }
00492 
00493   NumCompletelyUnrolled += CompletelyUnroll;
00494   ++NumUnrolled;
00495 
00496   Loop *OuterL = L->getParentLoop();
00497   // Remove the loop from the LoopPassManager if it's completely removed.
00498   if (CompletelyUnroll && LPM != nullptr)
00499     LPM->deleteLoopFromQueue(L);
00500 
00501   // If we have a pass and a DominatorTree we should re-simplify impacted loops
00502   // to ensure subsequent analyses can rely on this form. We want to simplify
00503   // at least one layer outside of the loop that was unrolled so that any
00504   // changes to the parent loop exposed by the unrolling are considered.
00505   if (PP && DT) {
00506     if (!OuterL && !CompletelyUnroll)
00507       OuterL = L;
00508     if (OuterL) {
00509       DataLayoutPass *DLP = PP->getAnalysisIfAvailable<DataLayoutPass>();
00510       const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
00511       ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
00512       simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE, DL, AT);
00513 
00514       // LCSSA must be performed on the outermost affected loop. The unrolled
00515       // loop's last loop latch is guaranteed to be in the outermost loop after
00516       // deleteLoopFromQueue updates LoopInfo.
00517       Loop *LatchLoop = LI->getLoopFor(Latches.back());
00518       if (!OuterL->contains(LatchLoop))
00519         while (OuterL->getParentLoop() != LatchLoop)
00520           OuterL = OuterL->getParentLoop();
00521 
00522       formLCSSARecursively(*OuterL, *DT, SE);
00523     }
00524   }
00525 
00526   return true;
00527 }