[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:20:48 PDT 2024
================
@@ -1824,7 +1824,14 @@ 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.
+ auto CheckIfMBBNonFirstTerminators = [](MachineInstr &MI) {
+ if (!MI.isTerminator())
+ return false;
+ return MI.getParent()->getFirstTerminator() != &MI;
+ };
+ if (ForceEmitZeroFlag && !CheckIfMBBNonFirstTerminators(MI))
----------------
arsenm wrote:
Go back to what it was before? There should be no reason to use getFirstTerminator
https://github.com/llvm/llvm-project/pull/112116
More information about the llvm-commits
mailing list