[llvm] [VPlan] Extend getSCEVForVPV, use to compute VPReplicateRecipe cost. (PR #161276)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 3 06:08:25 PDT 2025
================
@@ -3257,9 +3253,12 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
Type *PtrTy = isSingleScalar() ? ScalarPtrTy : toVectorTy(ScalarPtrTy, VF);
+ const SCEV *PtrSCEV = getAddressAccessSCEV(PtrOp, Ctx.SE, Ctx.L);
+ if (PtrSCEV && isa<SCEVCouldNotCompute>(PtrSCEV))
+ break;
InstructionCost ScalarCost =
ScalarMemOpCost + Ctx.TTI.getAddressComputationCost(
- PtrTy, &Ctx.SE, nullptr, Ctx.CostKind);
+ PtrTy, &Ctx.SE, PtrSCEV, Ctx.CostKind);
----------------
fhahn wrote:
This should be covered by a number of tests with replicating stores and the assertion that legacy & VPlan cost model agree
https://github.com/llvm/llvm-project/pull/161276
More information about the llvm-commits
mailing list