[llvm] [AArch64] Prevent argument promotion of vector with size > 128 bits (PR #70034)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 04:52:58 PDT 2023


================
@@ -212,6 +212,27 @@ bool AArch64TTIImpl::areInlineCompatible(const Function *Caller,
   return (CallerBits & CalleeBits) == CalleeBits;
 }
 
+bool AArch64TTIImpl::areTypesABICompatible(
+    const Function *Caller, const Function *Callee,
+    const ArrayRef<Type *> &Types) const {
+
+  // We need to ensure that argument promotion does not attempt to promote
+  // pointers to fixed-length vector types larger than 128 bits like
+  // <8 x float> (and pointers to aggregate types which have such fixed-length
+  // vector type members) into the values of the pointees. Such vector types
+  // are used for SVE VLS but there is no ABI for SVE VLS arguments and the
+  // backend cannot lower such value arguments. The 128-bit fixed-length SVE
+  // types can be safely treated as 128-bit NEON types and they cannot be
+  // distinguished in IR.
+  if (!BaseT::areTypesABICompatible(Caller, Callee, Types))
+    return false;
+
----------------
paulwalker-arm wrote:

I think we should be a little more permissive here and include:
```
if (!ST->useSVEForFixedLengthVectors())
  return true;
```
because when only NEON is used the larger operands are correctly split so I'd rather maintain that existing behaviour.

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


More information about the llvm-commits mailing list