diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/DCE.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/DCE.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index d55adf7c2d12..d309799d95f0 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -125,14 +125,11 @@ static bool eliminateDeadCode(Function &F, TargetLibraryInfo *TLI) { // Iterate over the original function, only adding insts to the worklist // if they actually need to be revisited. This avoids having to pre-init // the worklist with the entire function's worth of instructions. - for (inst_iterator FI = inst_begin(F), FE = inst_end(F); FI != FE;) { - Instruction *I = &*FI; - ++FI; - + for (Instruction &I : llvm::make_early_inc_range(instructions(F))) { // We're visiting this instruction now, so make sure it's not in the // worklist from an earlier visit. - if (!WorkList.count(I)) - MadeChange |= DCEInstruction(I, WorkList, TLI); + if (!WorkList.count(&I)) + MadeChange |= DCEInstruction(&I, WorkList, TLI); } while (!WorkList.empty()) { |
