diff options
author | Kazu Hirata <kazu@google.com> | 2021-09-13 08:57:23 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2021-09-13 08:57:23 -0700 |
commit | abca4c012f2a0938508db5af7ea421f426336663 (patch) | |
tree | c95c6d1af248ada227861e0d5a1d222f9ad2949b /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | ec92f788f34373eafb8b1663245a6ab425405abb (diff) | |
download | llvm-abca4c012f2a0938508db5af7ea421f426336663.zip llvm-abca4c012f2a0938508db5af7ea421f426336663.tar.gz llvm-abca4c012f2a0938508db5af7ea421f426336663.tar.bz2 |
[Utils] Use make_early_inc_range (NFC)
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index be062b4..1b99401 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -974,13 +974,12 @@ bool llvm::UnrollRuntimeLoopRemainder( const DataLayout &DL = L->getHeader()->getModule()->getDataLayout(); SmallVector<WeakTrackingVH, 16> DeadInsts; for (BasicBlock *BB : RemainderBlocks) { - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { - Instruction *Inst = &*I++; - if (Value *V = SimplifyInstruction(Inst, {DL, nullptr, DT, AC})) - if (LI->replacementPreservesLCSSAForm(Inst, V)) - Inst->replaceAllUsesWith(V); - if (isInstructionTriviallyDead(Inst)) - DeadInsts.emplace_back(Inst); + for (Instruction &Inst : llvm::make_early_inc_range(*BB)) { + if (Value *V = SimplifyInstruction(&Inst, {DL, nullptr, DT, AC})) + if (LI->replacementPreservesLCSSAForm(&Inst, V)) + Inst.replaceAllUsesWith(V); + if (isInstructionTriviallyDead(&Inst)) + DeadInsts.emplace_back(&Inst); } // We can't do recursive deletion until we're done iterating, as we might // have a phi which (potentially indirectly) uses instructions later in |