[llvm] [VPlan] Make canonical IV part of the region (PR #156262)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 22 08:54:26 PST 2026
================
@@ -3349,32 +3349,30 @@ void VPlanTransforms::canonicalizeEVLLoops(VPlan &Plan) {
EVLPhi->replaceAllUsesWith(ScalarR);
EVLPhi->eraseFromParent();
+ // The canonical IV phi is at the front of the header after dissolution.
// Replace CanonicalIVInc with EVL-PHI increment.
- auto *CanonicalIV = cast<VPPhi>(&*HeaderVPBB->begin());
- VPValue *Backedge = CanonicalIV->getIncomingValue(1);
- assert(match(Backedge, m_c_Add(m_Specific(CanonicalIV),
- m_Specific(&Plan.getVFxUF()))) &&
- "Unexpected canonical iv");
- Backedge->replaceAllUsesWith(EVLIncrement);
-
- // Remove unused phi and increment.
- VPRecipeBase *CanonicalIVIncrement = Backedge->getDefiningRecipe();
- CanonicalIVIncrement->eraseFromParent();
- CanonicalIV->eraseFromParent();
+ auto *CanonicalIV = dyn_cast<VPPhi>(&HeaderVPBB->front());
+ if (!CanonicalIV)
+ return;
----------------
ayalz wrote:
Should we assert that at-least one such backedge value was found (and RAUW'd with EVLIncrement) as before?
https://github.com/llvm/llvm-project/pull/156262
More information about the llvm-commits
mailing list