[llvm] [VPlan] Support VPWidenIntOrFpInductionRecipes with EVL tail folding (PR #144666)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 20 02:44:11 PDT 2025
================
@@ -2604,14 +2605,19 @@ 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
+ else if (VFTy->getScalarSizeInBits() > StepTy->getScalarSizeInBits())
VF =
Builder.createScalarCast(Instruction::CastOps::Trunc, VF, StepTy, DL);
+ else if (VFTy->getScalarSizeInBits() < StepTy->getScalarSizeInBits())
+ VF = Builder.createScalarCast(Instruction::CastOps::ZExt, VF, StepTy, DL);
----------------
Mel-Chen wrote:
Could this code replace with https://github.com/llvm/llvm-project/pull/144946/files?
https://github.com/llvm/llvm-project/pull/144666
More information about the llvm-commits
mailing list