[llvm] [AMDGPU] Avoid bundling memops in a MBB if the MBB contains a SCHED_BARRIER (PR #153533)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 08:49:53 PDT 2025


================
@@ -151,7 +152,12 @@ bool SIPostRABundler::run(MachineFunction &MF) {
   for (MachineBasicBlock &MBB : MF) {
     bool HasIGLPInstrs = llvm::any_of(MBB.instrs(), [](MachineInstr &MI) {
       unsigned Opc = MI.getOpcode();
-      return Opc == AMDGPU::SCHED_GROUP_BARRIER || Opc == AMDGPU::IGLP_OPT;
+      // Bypass a MBB with SCHED_BARRIER as well to make it honored.
+      // If SCHED_BARRIER is embedded between memory operations in a bundle,
+      // that SCHED_BARRIER is not picked up by IGLPmutation in post mi
+      // scheduler phase.
+      return Opc == AMDGPU::SCHED_GROUP_BARRIER || Opc == AMDGPU::IGLP_OPT ||
+             Opc == AMDGPU::SCHED_BARRIER;
----------------
jrbyrnes wrote:

I think we should special case the `SCHED_BARRIER 0` -- if we only have this type of SCHED_BARRIER, then bundling is okay.

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


More information about the llvm-commits mailing list