blob: e4be2d249aa17179c712f925998dc5dc9cc2bf5f [file] [log] [blame]
Chris Lattner83bf2882004-04-18 05:20:17 +00001//===-- LoopUnroll.cpp - Loop unroller pass -------------------------------===//
Misha Brukmanfd939082005-04-21 23:48:37 +00002//
Chris Lattner83bf2882004-04-18 05:20:17 +00003// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
Misha Brukmanfd939082005-04-21 23:48:37 +00007//
Chris Lattner83bf2882004-04-18 05:20:17 +00008//===----------------------------------------------------------------------===//
9//
10// This pass implements a simple loop unroller. It works best when loops have
11// been canonicalized by the -indvars pass, allowing it to determine the trip
12// counts of loops easily.
13//
Owen Anderson3b53c4e2006-08-24 21:28:19 +000014// This pass will multi-block loops only if they contain no non-unrolled
15// subloops. The process of unrolling can produce extraneous basic blocks
16// linked with unconditional branches. This will be corrected in the future.
Chris Lattner83bf2882004-04-18 05:20:17 +000017//
18//===----------------------------------------------------------------------===//
19
20#define DEBUG_TYPE "loop-unroll"
21#include "llvm/Transforms/Scalar.h"
22#include "llvm/Constants.h"
23#include "llvm/Function.h"
24#include "llvm/Instructions.h"
Chris Lattner79066fa2007-01-30 23:46:24 +000025#include "llvm/Analysis/ConstantFolding.h"
Chris Lattner83bf2882004-04-18 05:20:17 +000026#include "llvm/Analysis/LoopInfo.h"
Devang Patel3f1a1e02007-03-07 01:38:05 +000027#include "llvm/Analysis/LoopPass.h"
Chris Lattner83bf2882004-04-18 05:20:17 +000028#include "llvm/Transforms/Utils/Cloning.h"
29#include "llvm/Transforms/Utils/Local.h"
Owen Anderson59312b12006-08-28 02:09:46 +000030#include "llvm/Support/CFG.h"
Reid Spencer9133fe22007-02-05 23:32:05 +000031#include "llvm/Support/Compiler.h"
Reid Spencer551ccae2004-09-01 22:55:40 +000032#include "llvm/Support/CommandLine.h"
33#include "llvm/Support/Debug.h"
34#include "llvm/ADT/Statistic.h"
35#include "llvm/ADT/STLExtras.h"
Chris Lattner5e665f52007-02-03 00:08:31 +000036#include "llvm/ADT/SmallPtrSet.h"
Chris Lattner64613ea2004-11-22 17:18:36 +000037#include "llvm/IntrinsicInst.h"
Chris Lattner83bf2882004-04-18 05:20:17 +000038#include <cstdio>
Reid Spencer17e6e442004-10-18 14:38:48 +000039#include <algorithm>
Chris Lattner83bf2882004-04-18 05:20:17 +000040using namespace llvm;
41
Chris Lattner0e5f4992006-12-19 21:40:18 +000042STATISTIC(NumUnrolled, "Number of loops completely unrolled");
Chris Lattner83bf2882004-04-18 05:20:17 +000043
Chris Lattner0e5f4992006-12-19 21:40:18 +000044namespace {
Chris Lattner83bf2882004-04-18 05:20:17 +000045 cl::opt<unsigned>
Chris Lattnere3a55862004-04-18 18:06:14 +000046 UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden,
Chris Lattner83bf2882004-04-18 05:20:17 +000047 cl::desc("The cut-off point for loop unrolling"));
48
Devang Patel3f1a1e02007-03-07 01:38:05 +000049 class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
Chris Lattner83bf2882004-04-18 05:20:17 +000050 LoopInfo *LI; // The current loop information
51 public:
Devang Patel19974732007-05-03 01:11:54 +000052 static char ID; // Pass ID, replacement for typeid
Devang Patel794fd752007-05-01 21:15:47 +000053 LoopUnroll() : LoopPass((intptr_t)&ID) {}
54
Devang Patel3f1a1e02007-03-07 01:38:05 +000055 bool runOnLoop(Loop *L, LPPassManager &LPM);
Owen Anderson59312b12006-08-28 02:09:46 +000056 BasicBlock* FoldBlockIntoPredecessor(BasicBlock* BB);
Chris Lattner83bf2882004-04-18 05:20:17 +000057
58 /// This transformation requires natural loop information & requires that
59 /// loop preheaders be inserted into the CFG...
60 ///
61 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
Chris Lattner83bf2882004-04-18 05:20:17 +000062 AU.addRequiredID(LoopSimplifyID);
Owen Anderson3b53c4e2006-08-24 21:28:19 +000063 AU.addRequiredID(LCSSAID);
Chris Lattner83bf2882004-04-18 05:20:17 +000064 AU.addRequired<LoopInfo>();
Owen Anderson3b53c4e2006-08-24 21:28:19 +000065 AU.addPreservedID(LCSSAID);
Chris Lattner9c2cc462004-04-18 05:38:37 +000066 AU.addPreserved<LoopInfo>();
Chris Lattner83bf2882004-04-18 05:20:17 +000067 }
68 };
Devang Patel19974732007-05-03 01:11:54 +000069 char LoopUnroll::ID = 0;
Chris Lattner7f8897f2006-08-27 22:42:52 +000070 RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops");
Chris Lattner83bf2882004-04-18 05:20:17 +000071}
72
Devang Patel3f1a1e02007-03-07 01:38:05 +000073LoopPass *llvm::createLoopUnrollPass() { return new LoopUnroll(); }
Chris Lattner83bf2882004-04-18 05:20:17 +000074
75/// ApproximateLoopSize - Approximate the size of the loop after it has been
76/// unrolled.
77static unsigned ApproximateLoopSize(const Loop *L) {
78 unsigned Size = 0;
79 for (unsigned i = 0, e = L->getBlocks().size(); i != e; ++i) {
80 BasicBlock *BB = L->getBlocks()[i];
81 Instruction *Term = BB->getTerminator();
82 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
83 if (isa<PHINode>(I) && BB == L->getHeader()) {
84 // Ignore PHI nodes in the header.
85 } else if (I->hasOneUse() && I->use_back() == Term) {
86 // Ignore instructions only used by the loop terminator.
Reid Spencer3ed469c2006-11-02 20:25:50 +000087 } else if (isa<DbgInfoIntrinsic>(I)) {
Jeff Cohen9d809302005-04-23 21:38:35 +000088 // Ignore debug instructions
Chris Lattner83bf2882004-04-18 05:20:17 +000089 } else {
90 ++Size;
91 }
92
93 // TODO: Ignore expressions derived from PHI and constants if inval of phi
94 // is a constant, or if operation is associative. This will get induction
95 // variables.
96 }
97 }
98
99 return Size;
100}
101
Misha Brukmanfd939082005-04-21 23:48:37 +0000102// RemapInstruction - Convert the instruction operands from referencing the
Chris Lattner83bf2882004-04-18 05:20:17 +0000103// current values into those specified by ValueMap.
104//
Misha Brukmanfd939082005-04-21 23:48:37 +0000105static inline void RemapInstruction(Instruction *I,
Chris Lattner5e665f52007-02-03 00:08:31 +0000106 DenseMap<const Value *, Value*> &ValueMap) {
Chris Lattner83bf2882004-04-18 05:20:17 +0000107 for (unsigned op = 0, E = I->getNumOperands(); op != E; ++op) {
108 Value *Op = I->getOperand(op);
Chris Lattner5e665f52007-02-03 00:08:31 +0000109 DenseMap<const Value *, Value*>::iterator It = ValueMap.find(Op);
Chris Lattner83bf2882004-04-18 05:20:17 +0000110 if (It != ValueMap.end()) Op = It->second;
111 I->setOperand(op, Op);
112 }
113}
114
Owen Anderson59312b12006-08-28 02:09:46 +0000115// FoldBlockIntoPredecessor - Folds a basic block into its predecessor if it
116// only has one predecessor, and that predecessor only has one successor.
117// Returns the new combined block.
118BasicBlock* LoopUnroll::FoldBlockIntoPredecessor(BasicBlock* BB) {
119 // Merge basic blocks into their predecessor if there is only one distinct
120 // pred, and if there is only one distinct successor of the predecessor, and
121 // if there are no PHI nodes.
122 //
Owen Andersond648e142006-08-29 06:10:56 +0000123 BasicBlock *OnlyPred = BB->getSinglePredecessor();
124 if (!OnlyPred) return 0;
Owen Anderson59312b12006-08-28 02:09:46 +0000125
Owen Andersond648e142006-08-29 06:10:56 +0000126 if (OnlyPred->getTerminator()->getNumSuccessors() != 1)
127 return 0;
128
Bill Wendlingb7427032006-11-26 09:46:52 +0000129 DOUT << "Merging: " << *BB << "into: " << *OnlyPred;
Owen Andersond648e142006-08-29 06:10:56 +0000130
131 // Resolve any PHI nodes at the start of the block. They are all
132 // guaranteed to have exactly one entry if they exist, unless there are
133 // multiple duplicate (but guaranteed to be equal) entries for the
134 // incoming edges. This occurs when there are multiple edges from
135 // OnlyPred to OnlySucc.
136 //
137 while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) {
138 PN->replaceAllUsesWith(PN->getIncomingValue(0));
139 BB->getInstList().pop_front(); // Delete the phi node...
Owen Anderson59312b12006-08-28 02:09:46 +0000140 }
141
Owen Andersond648e142006-08-29 06:10:56 +0000142 // Delete the unconditional branch from the predecessor...
143 OnlyPred->getInstList().pop_back();
Owen Anderson59312b12006-08-28 02:09:46 +0000144
Owen Andersond648e142006-08-29 06:10:56 +0000145 // Move all definitions in the successor to the predecessor...
146 OnlyPred->getInstList().splice(OnlyPred->end(), BB->getInstList());
Owen Anderson59312b12006-08-28 02:09:46 +0000147
Owen Andersond648e142006-08-29 06:10:56 +0000148 // Make all PHI nodes that referred to BB now refer to Pred as their
149 // source...
150 BB->replaceAllUsesWith(OnlyPred);
Owen Anderson59312b12006-08-28 02:09:46 +0000151
Owen Andersond648e142006-08-29 06:10:56 +0000152 std::string OldName = BB->getName();
Owen Anderson59312b12006-08-28 02:09:46 +0000153
Owen Andersond648e142006-08-29 06:10:56 +0000154 // Erase basic block from the function...
155 LI->removeBlock(BB);
156 BB->eraseFromParent();
Owen Anderson59312b12006-08-28 02:09:46 +0000157
Owen Andersond648e142006-08-29 06:10:56 +0000158 // Inherit predecessors name if it exists...
159 if (!OldName.empty() && !OnlyPred->hasName())
160 OnlyPred->setName(OldName);
Owen Anderson59312b12006-08-28 02:09:46 +0000161
Owen Andersond648e142006-08-29 06:10:56 +0000162 return OnlyPred;
Owen Anderson59312b12006-08-28 02:09:46 +0000163}
164
Devang Patel3f1a1e02007-03-07 01:38:05 +0000165bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
Chris Lattner83bf2882004-04-18 05:20:17 +0000166 bool Changed = false;
Devang Patel3f1a1e02007-03-07 01:38:05 +0000167 LI = &getAnalysis<LoopInfo>();
Chris Lattner83bf2882004-04-18 05:20:17 +0000168
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000169 BasicBlock* Header = L->getHeader();
170 BasicBlock* LatchBlock = L->getLoopLatch();
Chris Lattner83bf2882004-04-18 05:20:17 +0000171
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000172 BranchInst *BI = dyn_cast<BranchInst>(LatchBlock->getTerminator());
Chris Lattner83bf2882004-04-18 05:20:17 +0000173 if (BI == 0) return Changed; // Must end in a conditional branch
174
175 ConstantInt *TripCountC = dyn_cast_or_null<ConstantInt>(L->getTripCount());
176 if (!TripCountC) return Changed; // Must have constant trip count!
177
Reid Spencer4e69f482007-03-02 23:31:34 +0000178 // Guard against huge trip counts. This also guards against assertions in
179 // APInt from the use of getZExtValue, below.
180 if (TripCountC->getValue().getActiveBits() > 32)
Chris Lattner83bf2882004-04-18 05:20:17 +0000181 return Changed; // More than 2^32 iterations???
182
Reid Spencer4e69f482007-03-02 23:31:34 +0000183 uint64_t TripCountFull = TripCountC->getZExtValue();
184 if (TripCountFull == 0)
185 return Changed; // Zero iteraitons?
186
Chris Lattner83bf2882004-04-18 05:20:17 +0000187 unsigned LoopSize = ApproximateLoopSize(L);
Bill Wendlingb7427032006-11-26 09:46:52 +0000188 DOUT << "Loop Unroll: F[" << Header->getParent()->getName()
189 << "] Loop %" << Header->getName() << " Loop Size = "
190 << LoopSize << " Trip Count = " << TripCountFull << " - ";
Chris Lattnerd4bc5642005-01-08 19:37:20 +0000191 uint64_t Size = (uint64_t)LoopSize*TripCountFull;
Chris Lattner82fec4e2004-05-13 20:43:31 +0000192 if (Size > UnrollThreshold) {
Bill Wendlingb7427032006-11-26 09:46:52 +0000193 DOUT << "TOO LARGE: " << Size << ">" << UnrollThreshold << "\n";
Chris Lattner83bf2882004-04-18 05:20:17 +0000194 return Changed;
195 }
Bill Wendlingb7427032006-11-26 09:46:52 +0000196 DOUT << "UNROLLING!\n";
Misha Brukmanfd939082005-04-21 23:48:37 +0000197
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000198 std::vector<BasicBlock*> LoopBlocks = L->getBlocks();
199
Chris Lattnerd4bc5642005-01-08 19:37:20 +0000200 unsigned TripCount = (unsigned)TripCountFull;
201
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000202 BasicBlock *LoopExit = BI->getSuccessor(L->contains(BI->getSuccessor(0)));
Chris Lattner83bf2882004-04-18 05:20:17 +0000203
204 // For the first iteration of the loop, we should use the precloned values for
205 // PHI nodes. Insert associations now.
Chris Lattner5e665f52007-02-03 00:08:31 +0000206 DenseMap<const Value*, Value*> LastValueMap;
Chris Lattner83bf2882004-04-18 05:20:17 +0000207 std::vector<PHINode*> OrigPHINode;
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000208 for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
Reid Spencer2da5c3d2004-09-15 17:06:42 +0000209 PHINode *PN = cast<PHINode>(I);
Chris Lattner83bf2882004-04-18 05:20:17 +0000210 OrigPHINode.push_back(PN);
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000211 if (Instruction *I =
212 dyn_cast<Instruction>(PN->getIncomingValueForBlock(LatchBlock)))
213 if (L->contains(I->getParent()))
Chris Lattner83bf2882004-04-18 05:20:17 +0000214 LastValueMap[I] = I;
215 }
216
217 // Remove the exit branch from the loop
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000218 LatchBlock->getInstList().erase(BI);
219
220 std::vector<BasicBlock*> Headers;
221 std::vector<BasicBlock*> Latches;
222 Headers.push_back(Header);
223 Latches.push_back(LatchBlock);
Chris Lattner83bf2882004-04-18 05:20:17 +0000224
225 assert(TripCount != 0 && "Trip count of 0 is impossible!");
226 for (unsigned It = 1; It != TripCount; ++It) {
227 char SuffixBuffer[100];
228 sprintf(SuffixBuffer, ".%d", It);
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000229
230 std::vector<BasicBlock*> NewBlocks;
231
232 for (std::vector<BasicBlock*>::iterator BB = LoopBlocks.begin(),
233 E = LoopBlocks.end(); BB != E; ++BB) {
Chris Lattner5e665f52007-02-03 00:08:31 +0000234 DenseMap<const Value*, Value*> ValueMap;
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000235 BasicBlock *New = CloneBasicBlock(*BB, ValueMap, SuffixBuffer);
236 Header->getParent()->getBasicBlockList().push_back(New);
Chris Lattner83bf2882004-04-18 05:20:17 +0000237
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000238 // Loop over all of the PHI nodes in the block, changing them to use the
239 // incoming values from the previous block.
240 if (*BB == Header)
241 for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
242 PHINode *NewPHI = cast<PHINode>(ValueMap[OrigPHINode[i]]);
243 Value *InVal = NewPHI->getIncomingValueForBlock(LatchBlock);
244 if (Instruction *InValI = dyn_cast<Instruction>(InVal))
245 if (It > 1 && L->contains(InValI->getParent()))
246 InVal = LastValueMap[InValI];
247 ValueMap[OrigPHINode[i]] = InVal;
248 New->getInstList().erase(NewPHI);
249 }
250
251 // Update our running map of newest clones
252 LastValueMap[*BB] = New;
Chris Lattner5e665f52007-02-03 00:08:31 +0000253 for (DenseMap<const Value*, Value*>::iterator VI = ValueMap.begin(),
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000254 VE = ValueMap.end(); VI != VE; ++VI)
255 LastValueMap[VI->first] = VI->second;
256
257 L->addBasicBlockToLoop(New, *LI);
258
259 // Add phi entries for newly created values to all exit blocks except
260 // the successor of the latch block. The successor of the exit block will
261 // be updated specially after unrolling all the way.
262 if (*BB != LatchBlock)
263 for (Value::use_iterator UI = (*BB)->use_begin(), UE = (*BB)->use_end();
264 UI != UE; ++UI) {
265 Instruction* UseInst = cast<Instruction>(*UI);
266 if (isa<PHINode>(UseInst) && !L->contains(UseInst->getParent())) {
267 PHINode* phi = cast<PHINode>(UseInst);
268 Value* Incoming = phi->getIncomingValueForBlock(*BB);
269 if (isa<Instruction>(Incoming))
270 Incoming = LastValueMap[Incoming];
271
272 phi->addIncoming(Incoming, New);
273 }
274 }
275
276 // Keep track of new headers and latches as we create them, so that
277 // we can insert the proper branches later.
278 if (*BB == Header)
279 Headers.push_back(New);
280 if (*BB == LatchBlock)
281 Latches.push_back(New);
282
283 NewBlocks.push_back(New);
Chris Lattner83bf2882004-04-18 05:20:17 +0000284 }
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000285
286 // Remap all instructions in the most recent iteration
287 for (unsigned i = 0; i < NewBlocks.size(); ++i)
288 for (BasicBlock::iterator I = NewBlocks[i]->begin(),
289 E = NewBlocks[i]->end(); I != E; ++I)
Chris Lattner998f44f2004-04-18 17:32:39 +0000290 RemapInstruction(I, LastValueMap);
Chris Lattner998f44f2004-04-18 17:32:39 +0000291 }
Chris Lattner83bf2882004-04-18 05:20:17 +0000292
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000293
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000294
295 // Update PHI nodes that reference the final latch block
296 if (TripCount > 1) {
Chris Lattner5e665f52007-02-03 00:08:31 +0000297 SmallPtrSet<PHINode*, 8> Users;
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000298 for (Value::use_iterator UI = LatchBlock->use_begin(),
299 UE = LatchBlock->use_end(); UI != UE; ++UI)
300 if (PHINode* phi = dyn_cast<PHINode>(*UI))
301 Users.insert(phi);
302
Chris Lattner5e665f52007-02-03 00:08:31 +0000303 for (SmallPtrSet<PHINode*,8>::iterator SI = Users.begin(), SE = Users.end();
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000304 SI != SE; ++SI) {
305 Value* InVal = (*SI)->getIncomingValueForBlock(LatchBlock);
306 if (isa<Instruction>(InVal))
307 InVal = LastValueMap[InVal];
308 (*SI)->removeIncomingValue(LatchBlock, false);
Owen Anderson20357252006-08-25 22:13:55 +0000309 if (InVal)
310 (*SI)->addIncoming(InVal, cast<BasicBlock>(LastValueMap[LatchBlock]));
Devang Patelac585162007-04-16 23:03:45 +0000311 if ((*SI)->getNumIncomingValues() == 0) {
312 // Remove this phi node.
313 // If anyone is using this PHI, make them use a dummy value instead...
314 (*SI)->replaceAllUsesWith(UndefValue::get((*SI)->getType()));
315 (*SI)->eraseFromParent();
316 }
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000317 }
318 }
Chris Lattner83bf2882004-04-18 05:20:17 +0000319
320 // Now loop over the PHI nodes in the original block, setting them to their
321 // incoming values.
322 BasicBlock *Preheader = L->getLoopPreheader();
323 for (unsigned i = 0, e = OrigPHINode.size(); i != e; ++i) {
324 PHINode *PN = OrigPHINode[i];
325 PN->replaceAllUsesWith(PN->getIncomingValueForBlock(Preheader));
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000326 Header->getInstList().erase(PN);
Owen Anderson59312b12006-08-28 02:09:46 +0000327 }
328
329 // Insert the branches that link the different iterations together
330 for (unsigned i = 0; i < Latches.size()-1; ++i) {
331 new BranchInst(Headers[i+1], Latches[i]);
332 if(BasicBlock* Fold = FoldBlockIntoPredecessor(Headers[i+1])) {
333 std::replace(Latches.begin(), Latches.end(), Headers[i+1], Fold);
334 std::replace(Headers.begin(), Headers.end(), Headers[i+1], Fold);
335 }
336 }
337
338 // Finally, add an unconditional branch to the block to continue into the exit
339 // block.
340 new BranchInst(LoopExit, Latches[Latches.size()-1]);
341 FoldBlockIntoPredecessor(LoopExit);
342
Chris Lattner83bf2882004-04-18 05:20:17 +0000343 // At this point, the code is well formed. We now do a quick sweep over the
344 // inserted code, doing constant propagation and dead code elimination as we
345 // go.
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000346 const std::vector<BasicBlock*> &NewLoopBlocks = L->getBlocks();
347 for (std::vector<BasicBlock*>::const_iterator BB = NewLoopBlocks.begin(),
Owen Anderson59312b12006-08-28 02:09:46 +0000348 BBE = NewLoopBlocks.end(); BB != BBE; ++BB)
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000349 for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) {
350 Instruction *Inst = I++;
Misha Brukmanfd939082005-04-21 23:48:37 +0000351
Owen Anderson3b53c4e2006-08-24 21:28:19 +0000352 if (isInstructionTriviallyDead(Inst))
353 (*BB)->getInstList().erase(Inst);
354 else if (Constant *C = ConstantFoldInstruction(Inst)) {
355 Inst->replaceAllUsesWith(C);
356 (*BB)->getInstList().erase(Inst);
357 }
Chris Lattner83bf2882004-04-18 05:20:17 +0000358 }
Chris Lattner83bf2882004-04-18 05:20:17 +0000359
Chris Lattner9c2cc462004-04-18 05:38:37 +0000360 // Update the loop information for this loop.
Chris Lattner9c2cc462004-04-18 05:38:37 +0000361 // Remove the loop from the parent.
Devang Patel3f1a1e02007-03-07 01:38:05 +0000362 LPM.deleteLoopFromQueue(L);
Chris Lattner9c2cc462004-04-18 05:38:37 +0000363
Chris Lattner83bf2882004-04-18 05:20:17 +0000364 ++NumUnrolled;
365 return true;
366}