[llvm] [LV] Add scalar load/stores to VPReplicateRecipe::computeCost (PR #153218)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 26 07:17:56 PDT 2025
================
@@ -2975,6 +2975,22 @@ InstructionCost VPReplicateRecipe::computeCost(ElementCount VF,
Op2Info, Operands, UI, &Ctx.TLI) *
(isSingleScalar() ? 1 : VF.getFixedValue());
}
+ case Instruction::Load:
+ case Instruction::Store: {
+ if (isSingleScalar()) {
+ Type *ValTy = getLoadStoreType(UI);
+ Type *ScalarPtrTy = getLoadStorePointerOperand(UI)->getType();
+ const Align Alignment = getLoadStoreAlignment(UI);
+ unsigned AS = getLoadStoreAddressSpace(UI);
+ TTI::OperandValueInfo OpInfo = TTI::getOperandInfo(UI->getOperand(0));
+ InstructionCost ScalarMemOpCost = Ctx.TTI.getMemoryOpCost(
+ UI->getOpcode(), ValTy, Alignment, AS, CostKind, OpInfo, UI);
+ return ScalarMemOpCost + Ctx.TTI.getAddressComputationCost(ScalarPtrTy);
+ }
+ // TODO: See getMemInstScalarizationCost for how to handle vector and
----------------
fhahn wrote:
```suggestion
// TODO: See getMemInstScalarizationCost for how to handle replicating and
```
This code here won't handle vector cases?
https://github.com/llvm/llvm-project/pull/153218
More information about the llvm-commits
mailing list