[llvm] [AArch64][TTI] Improve `LegalVF` when computing gather-loads cost (PR #69617)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 10:58:52 PDT 2023


================
@@ -2989,7 +2989,14 @@ InstructionCost AArch64TTIImpl::getGatherScatterOpCost(
       ElementCount::getScalable(1))
     return InstructionCost::getInvalid();
 
-  ElementCount LegalVF = LT.second.getVectorElementCount();
+  ElementCount LegalVF;
+  if (LT.second.isVector()) {
+    LegalVF = LT.second.getVectorElementCount();
+  } else {
+    // If the legalized type is a simple type, treat it as a 1-element vector.
+    LegalVF = ElementCount::getFixed(1);
+  }
+
----------------
antoniofrighetto wrote:

May that be the case though? Currently, few lines above, if `useNeonVector` is available, the cost is computed via `BaseT::getGatherScatterOpCost` before type-legalization.

https://github.com/llvm/llvm-project/pull/69617


More information about the llvm-commits mailing list