diff options
Diffstat (limited to 'gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp')
| -rw-r--r-- | gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp b/gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp index 9c4e13903ed..16af2c7b808 100644 --- a/gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/gnu/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -493,17 +493,13 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, // Handle PHI nodes specially, as we have to remove references to dead // blocks. - for (BasicBlock::const_iterator I = BI.begin(), E = BI.end(); I != E; ++I) { + for (const PHINode &PN : BI.phis()) { // PHI nodes may have been remapped to non-PHI nodes by the caller or // during the cloning process. - if (const PHINode *PN = dyn_cast<PHINode>(I)) { - if (isa<PHINode>(VMap[PN])) - PHIToResolve.push_back(PN); - else - break; - } else { + if (isa<PHINode>(VMap[&PN])) + PHIToResolve.push_back(&PN); + else break; - } } // Finally, remap the terminator instructions, as those can't be remapped @@ -747,7 +743,7 @@ Loop *llvm::cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB, Function *F = OrigLoop->getHeader()->getParent(); Loop *ParentLoop = OrigLoop->getParentLoop(); - Loop *NewLoop = new Loop(); + Loop *NewLoop = LI->AllocateLoop(); if (ParentLoop) ParentLoop->addChildLoop(NewLoop); else |
