Skip to content

Commit c82b31a

Browse files
committed
Add assertion on multiple evl-phi
1 parent 5008301 commit c82b31a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,13 +2397,22 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
23972397
};
23982398

23992399
// Find EVL loop entries by locating VPEVLBasedIVPHIRecipe
2400+
// There should be only one EVL PHI in the entire plan
2401+
VPEVLBasedIVPHIRecipe *EVLPhi = nullptr;
2402+
VPBasicBlock *EVLPhiBlock = nullptr;
2403+
24002404
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
24012405
vp_depth_first_shallow(Plan.getEntry())))
24022406
for (VPRecipeBase &R : VPBB->phis())
24032407
if (auto *PhiR = dyn_cast<VPEVLBasedIVPHIRecipe>(&R)) {
2404-
ConvertEVLPhi(Plan, VPBB, PhiR);
2405-
break;
2408+
assert(!EVLPhi && "Found multiple EVL PHIs - only one expected");
2409+
EVLPhi = PhiR;
2410+
EVLPhiBlock = VPBB;
24062411
}
2412+
2413+
// Process the single EVL PHI if found
2414+
if (EVLPhi)
2415+
ConvertEVLPhi(Plan, EVLPhiBlock, EVLPhi);
24072416
}
24082417

24092418
void VPlanTransforms::dropPoisonGeneratingRecipes(

0 commit comments

Comments
 (0)