[llvm] [AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already (PR #72830)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 06:22:17 PST 2023
Juan Manuel MARTINEZ =?utf-8?q?CAAMAÑO?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/72830 at github.com>
================
@@ -870,6 +875,15 @@ static bool updateOperandIfDifferent(MachineInstr &MI, uint16_t OpName,
return true;
}
+bool SIInsertWaitcnts::updateWaitcntIfSoft(MachineInstr *Waitcnt) const {
+ unsigned Opcode = Waitcnt->getOpcode();
+ if (!SIInstrInfo::isSoftWaitcnt(Opcode))
+ return false;
+
+ Waitcnt->setDesc(TII->get(SIInstrInfo::getNonSoftWaitcntOpcode(Opcode)));
----------------
jayfoad wrote:
I guess it's OK, but it still seems odd to me that we promote soft waitcnts both here and in `pseudoToMCOpcode`.
`SIInsertWaitcnts` is required for correctness (it is not just an optimization) so why is the `pseudoToMCOpcode` part required?
Alternatively, could we stop promoting soft waitcnts here? Or would that somehow change the behaviour of the second (or subsequent) visit to a basic block?
https://github.com/llvm/llvm-project/pull/72830
More information about the llvm-commits
mailing list