[llvm] [VPlan] Make CanIV part of region. (PR #144803)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 10 05:12:54 PDT 2025
================
@@ -1058,7 +1090,12 @@ void VPlan::execute(VPTransformState *State) {
// Move the last step to the end of the latch block. This ensures
// consistent placement of all induction updates.
Instruction *Inc = cast<Instruction>(Phi->getIncomingValue(1));
- Inc->moveBefore(std::prev(VectorLatchBB->getTerminator()->getIterator()));
+ if (VectorLatchBB->getTerminator()->getIterator() !=
----------------
ayalz wrote:
nit:
```suggestion
auto *LatchTermIter = VectorLatchBB->getTerminator()->getIterator();
if (LatchTermIter == VectorLatchBB->begin())
Inc->moveBefore(LatchTermIter);
else
Inc->moveBefore(std::prev(LatchTermIter));
```
https://github.com/llvm/llvm-project/pull/144803
More information about the llvm-commits
mailing list