[llvm] [AArch64] Disable consecutive store merging when Neon is unavailable (PR #111519)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 01:09:33 PDT 2024


================
@@ -27924,6 +27924,24 @@ bool AArch64TargetLowering::isIntDivCheap(EVT VT, AttributeList Attr) const {
   return OptSize && !VT.isVector();
 }
 
+bool AArch64TargetLowering::canMergeStoresTo(unsigned AddressSpace, EVT MemVT,
+                                             const MachineFunction &MF) const {
+  // Avoid merging stores into fixed-length vectors when Neon is unavailable.
+  // In future, we could allow this when SVE is available, but currently,
+  // the SVE lowerings for BUILD_VECTOR are limited to a few specific cases (and
+  // the general lowering may introduce stack spills/reloads).
+  if (MemVT.isFixedLengthVector() && !Subtarget->isNeonAvailable())
+    return false;
+
+  // Do not merge to float value size (128 bytes) if no implicit
+  // float attribute is set.
+  bool NoFloat = MF.getFunction().hasFnAttribute(Attribute::NoImplicitFloat);
+
+  if (NoFloat)
+    return (MemVT.getSizeInBits() <= 64);
+  return true;
----------------
sdesmalen-arm wrote:

nit: I know that you've just moved the code, but now that you've done it you could rewrite this to:
```suggestion
  return !NoFloat || MemVT.getSizeInBits() <= 64;
```

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


More information about the llvm-commits mailing list