[llvm] [VPlan] Get Addr computation cost with scalar type if it is uniform for gather/scatter. (PR #150371)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 23:54:50 PDT 2025
================
@@ -3099,9 +3099,18 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
const Value *Ptr = getLoadStorePointerOperand(&Ingredient);
assert(!Reverse &&
"Inconsecutive memory access should not have the order.");
- return Ctx.TTI.getAddressComputationCost(Ty) +
- Ctx.TTI.getGatherScatterOpCost(Opcode, Ty, Ptr, IsMasked, Alignment,
- Ctx.CostKind, &Ingredient);
+ InstructionCost Cost = 0;
+
+ // If the address value is uniform across all lane, then the address can be
+ // calculated with scalar type and broacast.
----------------
lukel97 wrote:
```suggestion
// If the address value is uniform across all lanes, then the address can be
// calculated with scalar type and broadcast.
```
https://github.com/llvm/llvm-project/pull/150371
More information about the llvm-commits
mailing list