[llvm] [VPlan] Split out EVL exit cond transform from canonicalizeEVLLoops. NFC (PR #178181)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 29 03:35:39 PST 2026
================
@@ -3247,9 +3247,9 @@ void VPlanTransforms::addExplicitVectorLength(
Plan.setUF(1);
}
-void VPlanTransforms::canonicalizeEVLLoops(VPlan &Plan) {
- // Find EVL loop entries by locating VPEVLBasedIVPHIRecipe.
- // There should be only one EVL PHI in the entire plan.
+/// Find EVL loop entries by locating VPEVLBasedIVPHIRecipe.
+/// There should be only one EVL PHI in the entire plan.
----------------
fhahn wrote:
Just to note that now we need to traverse the full VPlan twice if there's no EVL recipe.
would be good if there would a good way to exit early one we can't find a EVL recipe in the header if possible. There's `getFirstLoopHeader` which works on plain CFG but would require VPDT, which is likely not worth it unless already available.
I think later we assert that the first phi in EVL's parent is a canonical IV, via below. Maybe we could try to check this early, and bail out once we found a block with a canonical IV-like but not a VPEVLBasedIVPHIRecipe recipes. Not sure if we may be able to check if the increment of the phi is used by the expected branch-on-cond.
```
[[maybe_unused]] auto *CanIV = cast<VPPhi>(&*EVLPhi->getParent()->begin());
assert(
match(LatchExitingBr,
m_BranchOnCond(m_SpecificCmp(
CmpInst::ICMP_EQ, m_Specific(CanIV->getIncomingValue(1)),
m_Specific(&Plan.getVectorTripCount())))) &&
```
https://github.com/llvm/llvm-project/pull/178181
More information about the llvm-commits
mailing list