[llvm] [AArch64][TTI] Improve `LegalVF` when computing gather-loads cost (PR #69617)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 08:03:26 PDT 2023
================
@@ -2996,6 +2996,9 @@ static unsigned getSVEGatherScatterOverhead(unsigned Opcode) {
InstructionCost AArch64TTIImpl::getGatherScatterOpCost(
unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
+ if (!isLegalMaskedGatherScatter(DataTy))
----------------
davemgreen wrote:
This doesn't sound right - to return an invalid cost. If the gather/scatter can be scalarized then it should have some cost, even if it's quite high. There are some scalable vectors that can't be scalarized, but in general for fixed-width it should be OK.
Is the isElementTypeLegalForScalableVector check below enough to fix the issues you were seeing? We should probably have some fixed-length cost checks too.
If not, I think doing this would make sense, so that it returned the base cost:
```
if (useNeonVector(DataTy) || !isLegalMaskedGatherScatter(DataTy))
return BaseT::getGatherScatterOpCost(...)
```
https://github.com/llvm/llvm-project/pull/69617
More information about the llvm-commits
mailing list