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

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 05:34:04 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);
----------------
sjoerdmeijer wrote:

Hmm, good point, maybe.
Easiest is to move the alias check back into the if-statement, so will do that and I don't think we lose much debug info because I've also added a debug message to `mayAlias`. 

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


More information about the llvm-commits mailing list