diff options
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 46b60dc..4a0a1d9 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -530,10 +530,9 @@ bool CodeGenPrepare::runOnFunction(Function &F) { while (MadeChange) { MadeChange = false; DT.reset(); - for (Function::iterator I = F.begin(); I != F.end(); ) { - BasicBlock *BB = &*I++; + for (BasicBlock &BB : llvm::make_early_inc_range(F)) { bool ModifiedDTOnIteration = false; - MadeChange |= optimizeBlock(*BB, ModifiedDTOnIteration); + MadeChange |= optimizeBlock(BB, ModifiedDTOnIteration); // Restart BB iteration if the dominator tree of the Function was changed if (ModifiedDTOnIteration) @@ -8029,9 +8028,8 @@ bool CodeGenPrepare::placeDbgValues(Function &F) { DominatorTree DT(F); for (BasicBlock &BB : F) { - for (BasicBlock::iterator BI = BB.begin(), BE = BB.end(); BI != BE;) { - Instruction *Insn = &*BI++; - DbgValueInst *DVI = dyn_cast<DbgValueInst>(Insn); + for (Instruction &Insn : llvm::make_early_inc_range(BB)) { + DbgValueInst *DVI = dyn_cast<DbgValueInst>(&Insn); if (!DVI) continue; |