[llvm] [VPlan] Support VPWidenIntOrFpInductionRecipes with EVL tail folding (PR #144666)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 10:42:28 PDT 2025


================
@@ -2594,14 +2595,16 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
     Inc = SplatVF;
     Prev = WidenIVR->getLastUnrolledPartOperand();
   } else {
+    if (VPRecipeBase *R = VF->getDefiningRecipe())
+      Builder.setInsertPoint(R->getParent(), std::next(R->getIterator()));
+    Type *VFTy = TypeInfo.inferScalarType(VF);
     // Multiply the vectorization factor by the step using integer or
     // floating-point arithmetic as appropriate.
     if (StepTy->isFloatingPointTy())
       VF = Builder.createScalarCast(Instruction::CastOps::UIToFP, VF, StepTy,
                                     DL);
     else
-      VF =
-          Builder.createScalarCast(Instruction::CastOps::Trunc, VF, StepTy, DL);
+      VF = Builder.createScalarZExtOrTrunc(VF, StepTy, VFTy, DL);
----------------
preames wrote:

It looks like this change causes a test diff on it's own (i.e. removing a trunc), please separate and commit separately without the need for additional review.

https://github.com/llvm/llvm-project/pull/144666


More information about the llvm-commits mailing list