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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 22:08:11 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())
----------------
arsenm wrote:

We should be able to assume all terminators are not memory instructions 

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


More information about the llvm-commits mailing list