[llvm] [AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already (PR #72830)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 00:18:40 PST 2023


Juan Manuel MARTINEZ =?utf-8?q?CAAMAÑO?= <juamarti at amd.com>,pvanhout
 <pierre.vanhoutryve at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/72830 at github.com>


================
@@ -886,34 +902,40 @@ bool SIInsertWaitcnts::applyPreexistingWaitcnt(
     if (II.isMetaInstruction())
       continue;
 
-    if (II.getOpcode() == AMDGPU::S_WAITCNT) {
+    unsigned Opcode = II.getOpcode();
+    bool CanFullyDiscardWaitcntSequence = SIInstrInfo::isSoftWaitcnt(Opcode);
+
+    if (SIInstrInfo::isWaitcnt(Opcode)) {
       // Conservatively update required wait if this waitcnt was added in an
       // earlier pass. In this case it will not exist in the tracked waitcnt
       // set.
----------------
rovka wrote:

Well, there's no more tracked waitcnt set, so we should rephrase it in terms of soft waitcnts instead.

Something along the lines of "Update required wait. If this waitcnt was added in an earlier pass, but is no longer needed, it may be removed." 

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


More information about the llvm-commits mailing list