[llvm] [VPlan] Delay adding canonical IV increment. (PR #82270)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 03:12:17 PST 2024
================
@@ -1618,30 +1578,26 @@ bool VPlanTransforms::tryAddExplicitVectorLength(
auto *VPEVL = Builder.createNaryOp(VPInstruction::ExplicitVectorLength, AVL,
DebugLoc());
- auto *CanonicalIVIncrement =
- cast<VPInstruction>(CanonicalIVPHI->getBackedgeValue());
VPSingleDefRecipe *OpVPEVL = VPEVL;
+ VPRecipeBase *LatchTerm = Latch->getTerminator();
if (unsigned IVSize = CanonicalIVPHI->getScalarType()->getScalarSizeInBits();
IVSize != 32) {
OpVPEVL = new VPScalarCastRecipe(IVSize < 32 ? Instruction::Trunc
: Instruction::ZExt,
OpVPEVL, CanonicalIVPHI->getScalarType());
- OpVPEVL->insertBefore(CanonicalIVIncrement);
+ OpVPEVL->insertBefore(LatchTerm);
}
auto *NextEVLIV =
- new VPInstruction(Instruction::Add, {OpVPEVL, EVLPhi},
- {CanonicalIVIncrement->hasNoUnsignedWrap(),
- CanonicalIVIncrement->hasNoSignedWrap()},
- CanonicalIVIncrement->getDebugLoc(), "index.evl.next");
- NextEVLIV->insertBefore(CanonicalIVIncrement);
+ new VPInstruction(Instruction::Add, {OpVPEVL, EVLPhi}, {false, false},
+ CanonicalIVPHI->getDebugLoc(), "index.evl.next");
+ NextEVLIV->insertBefore(LatchTerm);
EVLPhi->addOperand(NextEVLIV);
transformRecipestoEVLRecipes(Plan, *VPEVL);
// Replace all uses of VPCanonicalIVPHIRecipe by
- // VPEVLBasedIVPHIRecipe except for the canonical IV increment.
----------------
fhahn wrote:
Yes updated, thanks
https://github.com/llvm/llvm-project/pull/82270
More information about the llvm-commits
mailing list