[llvm] [AMDGPU] Skip non-first termintors when forcing emit zero flag (PR #112116)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 22:14:09 PDT 2024


================
@@ -1824,7 +1824,9 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
   // Verify that the wait is actually needed.
   ScoreBrackets.simplifyWaitcnt(Wait);
 
-  if (ForceEmitZeroFlag)
+  // When forcing emit, we need to skip terminators of a MBB because that would
+  // break the terminators of the MBB.
+  if (ForceEmitZeroFlag && !MI.isTerminator())
----------------
shiltian wrote:

which means we don't actually need a wait even before the first terminator?

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


More information about the llvm-commits mailing list