[llvm] [AMDGPU][SIInsertWaitcnts] drop OldWaitcntInstr only when it is processed (PR #145720)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 08:41:23 PDT 2025


================
@@ -2490,7 +2493,6 @@ bool SIInsertWaitcnts::insertWaitcntInBlock(MachineFunction &MF,
     // Generate an s_waitcnt instruction to be placed before Inst, if needed.
     Modified |= generateWaitcntInstBefore(Inst, ScoreBrackets, OldWaitcntInstr,
                                           FlushVmCnt);
-    OldWaitcntInstr = nullptr;
----------------
ssahasra wrote:

Indeed this works, and is much cleaner. Thanks! One could argue that this duplicates the handling of meta instructions, but it's still much more readable than passing a pointer reference and updating it deep inside the callstack. 

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


More information about the llvm-commits mailing list