[llvm] [AArch64LoadStoreOptimizer] Debug messages to track decision making. NFC (PR #77593)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 05:21:58 PST 2024


================
@@ -1884,14 +1894,25 @@ AArch64LoadStoreOpt::findMatchingInsn(MachineBasicBlock::iterator I,
         const bool SameLoadReg = MayLoad && TRI->isSuperOrSubRegisterEq(
                                                 Reg, getLdStRegOp(MI).getReg());
 
-        // If the Rt of the second instruction was not modified or used between
-        // the two instructions and none of the instructions between the second
-        // and first alias with the second, we can combine the second into the
-        // first.
-        if (ModifiedRegUnits.available(getLdStRegOp(MI).getReg()) &&
-            !(MI.mayLoad() && !SameLoadReg &&
-              !UsedRegUnits.available(getLdStRegOp(MI).getReg())) &&
-            !mayAlias(MI, MemInsns, AA)) {
+        // If the Rt of the second instruction (destination register of the
+        // load) was not modified or used between the two instructions and none
+        // of the instructions between the second and first alias with the
+        // second, we can combine the second into the first.
+        bool RtNotModified =
+            ModifiedRegUnits.available(getLdStRegOp(MI).getReg());
+        bool RtNotUsed = !(MI.mayLoad() && !SameLoadReg &&
+                           !UsedRegUnits.available(getLdStRegOp(MI).getReg()));
+        bool DontAlias = !mayAlias(MI, MemInsns, AA);
----------------
davemgreen wrote:

I've not ran this but it looks sensible to me.

One question - could the mayAlias call be comparatively slow? Could this slow compile time if we don't do it conditionally now?

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


More information about the llvm-commits mailing list