[llvm] [AMDGPU][SIInsertWaitcnts] Wait on all LDS DMA operations when no aliasing store is found (PR #170660)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 02:11:46 PST 2025


================
@@ -1086,13 +1086,17 @@ void WaitcntBrackets::updateByEvent(WaitEventType E, MachineInstr &Inst) {
             }
           }
         }
-        if (Slot || LDSDMAStores.size() == NUM_LDS_VGPRS - 1)
+        if (Slot)
           break;
+        // The slot may not be valid because it can be >= NUM_LDS_VGPRS which
+        // means the scoreboard cannot track it. We still want to preserve the
+        // MI in order to check alias information, though.
         LDSDMAStores.push_back(&Inst);
         Slot = LDSDMAStores.size();
         break;
       }
-      setRegScore(FIRST_LDS_VGPR + Slot, T, CurrScore);
+      if (Slot < NUM_LDS_VGPRS)
+        setRegScore(FIRST_LDS_VGPR + Slot, T, CurrScore);
       if (Slot)
         setRegScore(FIRST_LDS_VGPR, T, CurrScore);
----------------
jayfoad wrote:

Just curious: can Slot ever be 0 when we exit the loop above? It's not clear to me if these "if"s handle that case correctly, if it can ever happen.

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


More information about the llvm-commits mailing list