[llvm] [LV] Convert gather loads with constant stride into strided loads (PR #147297)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 7 07:41:50 PDT 2026
================
@@ -2071,6 +2079,30 @@ void VPWidenIntrinsicRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
}
#endif
+void VPWidenMemIntrinsicRecipe::execute(VPTransformState &State) {
+ CallInst *MemI = createVectorCall(State);
+ MemI->addParamAttr(
+ 0, Attribute::getWithAlignment(MemI->getContext(), Alignment));
+ State.set(this, MemI);
+}
+
+InstructionCost VPWidenMemIntrinsicRecipe::computeMemIntrinsicCost(
+ Intrinsic::ID IID, Type *Ty, bool IsMasked, Align Alignment,
+ VPCostContext &Ctx) {
+ return Ctx.TTI.getMemIntrinsicInstrCost(
+ MemIntrinsicCostAttributes(IID, Ty, /*Ptr=*/nullptr, IsMasked, Alignment),
+ Ctx.CostKind);
+}
+
+InstructionCost
+VPWidenMemIntrinsicRecipe::computeCost(ElementCount VF,
+ VPCostContext &Ctx) const {
+ Type *Ty = toVectorTy(getScalarType(), VF);
+ return computeMemIntrinsicCost(getVectorIntrinsicID(), Ty,
+ !match(getOperand(2), m_True()), Alignment,
+ Ctx);
+}
----------------
Mel-Chen wrote:
Currently, there is no way to test this cost by vectorizer.
However, using the cost-model pass might be work: if we specify an alignment smaller than the element size on llvm.experimental.vp.strided.load, we should be able to directly trigger and verify this fallback branch. WDYT?
https://github.com/llvm/llvm-project/pull/147297
More information about the llvm-commits
mailing list