//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Devang Patel and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
DominatorTree *DT = NULL;
DominanceFrontier *DF = NULL;
if (P) {
- DT = P->getAnalysisToUpdate<DominatorTree>();
- DF = P->getAnalysisToUpdate<DominanceFrontier>();
+ DT = P->getAnalysisIfAvailable<DominatorTree>();
+ DF = P->getAnalysisIfAvailable<DominanceFrontier>();
}
SmallVector<BasicBlock *, 16> NewBlocks;
Loop *NewParentLoop = NULL;
while (!LoopNest.empty()) {
- Loop *L = LoopNest.back();
- LoopNest.pop_back();
+ Loop *L = LoopNest.pop_back_val();
Loop *NewLoop = new Loop();
if (!NewParentLoop)
ValueMap[BB] = NewBB;
if (P)
LPM->cloneBasicBlockSimpleAnalysis(BB, NewBB, L);
- NewLoop->addBasicBlockToLoop(NewBB, *LI);
+ NewLoop->addBasicBlockToLoop(NewBB, LI->getBase());
NewBlocks.push_back(NewBB);
}
BasicBlock *Latch = OrigL->getLoopLatch();
Function *F = Latch->getParent();
- F->getBasicBlockList().insert(Latch, NewBlocks.begin(), NewBlocks.end());
+ F->getBasicBlockList().insert(OrigL->getHeader(),
+ NewBlocks.begin(), NewBlocks.end());
+
return NewParentLoop;
}