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

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 10:20:41 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);
+  }
+
----------------
alexey-bataev wrote:

Shall isLegalMaskedGather() just return false for such types instead?

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


More information about the llvm-commits mailing list