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

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Oct 13 21:37:39 PDT 2024


================
@@ -1825,7 +1836,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 non-first terminators of a MBB because
+  // that would break the terminators of the MBB.
+  if (ForceEmitZeroFlag && !checkIfMBBNonFirstTerminator(MI))
----------------
arsenm wrote:

You're scanning the terminators for every instruction. Can you adjust the outer iterator logic to skip the terminators in the first place? 

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


More information about the llvm-branch-commits mailing list