@@ -2309,10 +2309,12 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
23092309// / ...
23102310// / %EVLPhi = EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI [ %StartV, %vector.ph ],
23112311// / [ %NextEVLIV, %vector.body ]
2312- // / %AVL = sub original TC , %EVLPhi
2312+ // / %AVL = phi [ trip-count , %vector.ph ], [ %NextAVL, %vector.body ]
23132313// / %VPEVL = EXPLICIT-VECTOR-LENGTH %AVL
23142314// / ...
2315- // / %NextEVLIV = add IVSize (cast i32 %VPEVVL to IVSize), %EVLPhi
2315+ // / %OpEVL = cast i32 %VPEVL to IVSize
2316+ // / %NextEVLIV = add IVSize %OpEVL, %EVLPhi
2317+ // / %NextAVL = sub IVSize nuw %AVL, %OpEVL
23162318// / ...
23172319// /
23182320// / If MaxSafeElements is provided, the function adds the following recipes:
@@ -2323,12 +2325,14 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
23232325// / ...
23242326// / %EVLPhi = EXPLICIT-VECTOR-LENGTH-BASED-IV-PHI [ %StartV, %vector.ph ],
23252327// / [ %NextEVLIV, %vector.body ]
2326- // / %AVL = sub original TC , %EVLPhi
2328+ // / %AVL = phi [ trip-count , %vector.ph ], [ %NextAVL, %vector.body ]
23272329// / %cmp = cmp ult %AVL, MaxSafeElements
23282330// / %SAFE_AVL = select %cmp, %AVL, MaxSafeElements
23292331// / %VPEVL = EXPLICIT-VECTOR-LENGTH %SAFE_AVL
23302332// / ...
2331- // / %NextEVLIV = add IVSize (cast i32 %VPEVL to IVSize), %EVLPhi
2333+ // / %OpEVL = cast i32 %VPEVL to IVSize
2334+ // / %NextEVLIV = add IVSize %OpEVL, %EVLPhi
2335+ // / %NextAVL = sub IVSize nuw %AVL, %OpEVL
23322336// / ...
23332337// /
23342338bool VPlanTransforms::tryAddExplicitVectorLength (
0 commit comments