[llvm] [AArch64][GlobalISel] Add support for pre-indexed loads/stores. (PR #70185)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 23:29:14 PDT 2023


================
@@ -1141,11 +1141,28 @@ bool CombinerHelper::findPreIndexCandidate(GLoadStore &LdSt, Register &Addr,
       return false;
   }
 
+  // Avoid increasing cross-block register pressure.
+  for (auto &AddrUse : MRI.use_nodbg_instructions(Addr))
+    if (AddrUse.getParent() != LdSt.getParent())
+      return false;
+
   // FIXME: check whether all uses of the base pointer are constant PtrAdds.
   // That might allow us to end base's liveness here by adjusting the constant.
-
-  return all_of(MRI.use_nodbg_instructions(Addr),
-                [&](MachineInstr &UseMI) { return dominates(LdSt, UseMI); });
+  bool RealUse = false;
+  for (auto &AddrUse : MRI.use_nodbg_instructions(Addr)) {
+    if (!dominates(LdSt, AddrUse))
----------------
aemerson wrote:

The foldable check isn't an early exit, so we still need to do this for every use.

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


More information about the llvm-commits mailing list