================ @@ -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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits