LoopSimplify.cpp (199989) | LoopSimplify.cpp (201360) |
---|---|
1//===- LoopSimplify.cpp - Loop Canonicalization Pass ----------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 95 unchanged lines hidden (view full) --- 104char LoopSimplify::ID = 0; 105static RegisterPass<LoopSimplify> 106X("loopsimplify", "Canonicalize natural loops", true); 107 108// Publically exposed interface to pass... 109const PassInfo *const llvm::LoopSimplifyID = &X; 110Pass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); } 111 | 1//===- LoopSimplify.cpp - Loop Canonicalization Pass ----------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 95 unchanged lines hidden (view full) --- 104char LoopSimplify::ID = 0; 105static RegisterPass<LoopSimplify> 106X("loopsimplify", "Canonicalize natural loops", true); 107 108// Publically exposed interface to pass... 109const PassInfo *const llvm::LoopSimplifyID = &X; 110Pass *llvm::createLoopSimplifyPass() { return new LoopSimplify(); } 111 |
112/// runOnFunction - Run down all loops in the CFG (recursively, but we could do | 112/// runOnLoop - Run down all loops in the CFG (recursively, but we could do |
113/// it in any convenient order) inserting preheaders... 114/// 115bool LoopSimplify::runOnLoop(Loop *l, LPPassManager &LPM) { 116 L = l; 117 bool Changed = false; 118 LI = &getAnalysis<LoopInfo>(); 119 AA = getAnalysisIfAvailable<AliasAnalysis>(); 120 DT = &getAnalysis<DominatorTree>(); --- 179 unchanged lines hidden (view full) --- 300 if (DF) DF->removeBlock(ExitingBlock); 301 302 BI->getSuccessor(0)->removePredecessor(ExitingBlock); 303 BI->getSuccessor(1)->removePredecessor(ExitingBlock); 304 ExitingBlock->eraseFromParent(); 305 } 306 } 307 | 113/// it in any convenient order) inserting preheaders... 114/// 115bool LoopSimplify::runOnLoop(Loop *l, LPPassManager &LPM) { 116 L = l; 117 bool Changed = false; 118 LI = &getAnalysis<LoopInfo>(); 119 AA = getAnalysisIfAvailable<AliasAnalysis>(); 120 DT = &getAnalysis<DominatorTree>(); --- 179 unchanged lines hidden (view full) --- 300 if (DF) DF->removeBlock(ExitingBlock); 301 302 BI->getSuccessor(0)->removePredecessor(ExitingBlock); 303 BI->getSuccessor(1)->removePredecessor(ExitingBlock); 304 ExitingBlock->eraseFromParent(); 305 } 306 } 307 |
308 // If there are duplicate phi nodes (for example, from loop rotation), 309 // get rid of them. 310 for (Loop::block_iterator BB = L->block_begin(), E = L->block_end(); 311 BB != E; ++BB) 312 EliminateDuplicatePHINodes(*BB); 313 | |
314 return Changed; 315} 316 317/// InsertPreheaderForLoop - Once we discover that a loop doesn't have a 318/// preheader, this method is called to insert one. This method has two phases: 319/// preheader insertion and analysis updating. 320/// 321BasicBlock *LoopSimplify::InsertPreheaderForLoop(Loop *L) { --- 373 unchanged lines hidden --- | 308 return Changed; 309} 310 311/// InsertPreheaderForLoop - Once we discover that a loop doesn't have a 312/// preheader, this method is called to insert one. This method has two phases: 313/// preheader insertion and analysis updating. 314/// 315BasicBlock *LoopSimplify::InsertPreheaderForLoop(Loop *L) { --- 373 unchanged lines hidden --- |