[llvm] [AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already (PR #72830)
Carl Ritson via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 16 22:52:56 PST 2023
perlfu wrote:
@Pierre-vh I am seeing some regressions from this change causing generation of extra unnecessary `s_waitcnt` instructions.
See attached test: `llc -march=amdgcn -start-before=si-insert-waitcnts -mcpu=gfx1030 -verify-machineinstrs -mattr=+wavefrontsize32,-wavefrontsize64 -o - test.mir`
```
s_waitcnt vmcnt(0)
v_mov_b32_e32 v0, 0
s_waitcnt vmcnt(1) <-- new extra s_waitcnt
v_readfirstlane_b32 s8, v7
v_readfirstlane_b32 s9, v8
v_readfirstlane_b32 s10, v9
v_readfirstlane_b32 s11, v10
v_readfirstlane_b32 s12, v11
v_readfirstlane_b32 s13, v12
v_readfirstlane_b32 s14, v13
v_readfirstlane_b32 s15, v14
s_waitcnt vmcnt(0) <-- new extra s_waitcnt
v_readfirstlane_b32 s16, v15
v_readfirstlane_b32 s17, v16
v_readfirstlane_b32 s18, v17
v_readfirstlane_b32 s19, v18
v_mov_b32_e32 v1, v0
```
[test.mir.gz](https://github.com/llvm/llvm-project/files/13695014/test.mir.gz)
https://github.com/llvm/llvm-project/pull/72830
More information about the llvm-commits
mailing list