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//===----------------------------------------------------------------------===//
--- 291 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) {
--- 368 unchanged lines hidden ---
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//===----------------------------------------------------------------------===//
--- 291 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) {
--- 368 unchanged lines hidden ---