[llvm] [AMDGPU] Remove some unneeded waits for VA_VDST (PR #210741)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 08:55:23 PDT 2026


================
@@ -1484,8 +1492,16 @@ void WaitcntBrackets::tryClearSCCWriteEvent(MachineInstr *Inst) {
 }
 
 void WaitcntBrackets::applyWaitcnt(const AMDGPU::Waitcnt &Wait) {
-  for (AMDGPU::InstCounterType T : AMDGPU::inst_counter_types())
-    applyWaitcnt(Wait, T);
+  for (AMDGPU::InstCounterType T : AMDGPU::inst_counter_types()) {
+    unsigned Cnt;
+    if (T == AMDGPU::VA_VDST_RD || T == AMDGPU::VA_VDST_WR) {
+      Cnt =
+          std::min(Wait.get(AMDGPU::VA_VDST_RD), Wait.get(AMDGPU::VA_VDST_WR));
----------------
jayfoad wrote:

It's not hard to bypass. Anyone who directly calls the `applyWaitcnt(const AMDGPU::Waitcnt, AMDGPU::InstCounterType)` overload could do bypass it. But that would be wrong of them, and the `verify()` checking aded by this PR should catch it.

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


More information about the llvm-commits mailing list