[llvm] [AMDGPU][SIInsertWaitcnts] Do not add s_waitcnt when the counters are known to be 0 already (PR #72830)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 05:49:10 PST 2023
================
@@ -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)));
----------------
Pierre-vh wrote:
> Why do we need this here as well as in pseudoToMCOpcode?
So soft waitcnts can be lowered into MCInsts
When I picked up this patch, IIRC, I tried to remove the one in `pseudoToMCOpcode` (and make soft waitcnts illegal to lower to MCInst) but it didn't work. I can try again if you want
> Note that SIInsertWaitcnts is iterative, so it may process the same block several times. If that happens then by the time the it runs the second time on a block, all remaining soft waitcnts will have been converted to hard ones by the first pass. Is that desirable for some reason?
Not sure, I'll think about it
https://github.com/llvm/llvm-project/pull/72830
More information about the llvm-commits
mailing list