diff options
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 36919ca..0e5d5e4 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -1023,11 +1023,10 @@ void WinEHPrepare::removeImplausibleInstructions(Function &F) { void WinEHPrepare::cleanupPreparedFunclets(Function &F) { // Clean-up some of the mess we made by removing useles PHI nodes, trivial // branches, etc. - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) { - BasicBlock *BB = &*FI++; - SimplifyInstructionsInBlock(BB); - ConstantFoldTerminator(BB, /*DeleteDeadConditions=*/true); - MergeBlockIntoPredecessor(BB); + for (BasicBlock &BB : llvm::make_early_inc_range(F)) { + SimplifyInstructionsInBlock(&BB); + ConstantFoldTerminator(&BB, /*DeleteDeadConditions=*/true); + MergeBlockIntoPredecessor(&BB); } // We might have some unreachable blocks after cleaning up some impossible @@ -1107,9 +1106,7 @@ AllocaInst *WinEHPrepare::insertPHILoads(PHINode *PN, Function &F) { // Otherwise, we have a PHI on a terminator EHPad, and we give up and insert // loads of the slot before every use. DenseMap<BasicBlock *, Value *> Loads; - for (Value::use_iterator UI = PN->use_begin(), UE = PN->use_end(); - UI != UE;) { - Use &U = *UI++; + for (Use &U : llvm::make_early_inc_range(PN->uses())) { auto *UsingInst = cast<Instruction>(U.getUser()); if (isa<PHINode>(UsingInst) && UsingInst->getParent()->isEHPad()) { // Use is on an EH pad phi. Leave it alone; we'll insert loads and |