[llvm] 79d4019 - [amdgpu] Fix scoreboard updating on `s_waitcnt_vscnt`.

Michael Liao via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 31 11:20:37 PST 2019


Author: Michael Liao
Date: 2019-12-31T14:20:30-05:00
New Revision: 79d401905fcf519da732b33ee9dffd18f2da3b10

URL: https://github.com/llvm/llvm-project/commit/79d401905fcf519da732b33ee9dffd18f2da3b10
DIFF: https://github.com/llvm/llvm-project/commit/79d401905fcf519da732b33ee9dffd18f2da3b10.diff

LOG: [amdgpu] Fix scoreboard updating on `s_waitcnt_vscnt`.

Summary: - Other counters are accidentally cleared.

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71866

Added: 
    llvm/test/CodeGen/AMDGPU/waitcnt-vscnt.mir

Modified: 
    llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
index bfeaebde386d..927826c52404 100644
--- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
@@ -1081,7 +1081,7 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(
           assert(II->getOpcode() == AMDGPU::S_WAITCNT_VSCNT);
           assert(II->getOperand(0).getReg() == AMDGPU::SGPR_NULL);
           ScoreBrackets.applyWaitcnt(
-              AMDGPU::Waitcnt(0, 0, 0, II->getOperand(1).getImm()));
+              AMDGPU::Waitcnt(~0u, ~0u, ~0u, II->getOperand(1).getImm()));
         }
       }
     }

diff  --git a/llvm/test/CodeGen/AMDGPU/waitcnt-vscnt.mir b/llvm/test/CodeGen/AMDGPU/waitcnt-vscnt.mir
new file mode 100644
index 000000000000..e9d8ebe4d80f
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/waitcnt-vscnt.mir
@@ -0,0 +1,17 @@
+# RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefix=GFX10 %s
+
+# GFX10-LABEL: waitcnt-vscnt
+# GFX10: GLOBAL_ATOMIC_ADD_RTN
+# GFX10-NEXT: S_WAITCNT 49279
+---
+name: waitcnt-vscnt
+machineFunctionInfo:
+  isEntryFunction: true
+body: |
+  bb.0:
+    liveins: $sgpr0_sgpr1
+    $sgpr4 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 4, 0, 0 :: (dereferenceable invariant load 4 from `i32 addrspace(4)* undef`)
+    S_WAITCNT_VSCNT undef $sgpr_null, 0
+    $vgpr0 = GLOBAL_ATOMIC_ADD_RTN $vgpr0_vgpr1, $vgpr2, 0, 0, implicit $exec :: (load store syncscope("agent") seq_cst 4, addrspace 1)
+    S_CMP_LG_U32 killed $sgpr4, 0, implicit-def $scc
+...


        


More information about the llvm-commits mailing list