[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
https://github.com/lukel97 approved this pull request.
LGTM.
Btw, I think this makes more sense if we change the `Type` argument to `getAddressComputationCost` to the type of the pointer, not the value. But we don't do this consistently today.
`LoopVectorizationCostModel::getMemInstScalarizationCost` passes in the pointer type:
```c++
// Get the cost of the scalar memory instruction and address computation.
InstructionCost Cost =
VF.getFixedValue() * TTI.getAddressComputationCost(PtrTy, SE, PtrSCEV);
```
X86 calls it PtrTy:
```c++
InstructionCost getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE,
```
But VectorCombine passes in the element type:
```c++
ScalarizedCost += TTI.getAddressComputationCost(VecTy->getElementType());
```
As does `VPWidenMemoryRecipe::computeCost`.
I think we should fix this in a separate PR.
https://github.com/llvm/llvm-project/pull/150371
More information about the llvm-commits
mailing list