[llvm] A SCHED_BARRIER in a bundle should not prevent other SCHED_BARRIERs to be considered (PR #152627)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 20:55:58 PDT 2025


================
@@ -2508,7 +2508,9 @@ bool SchedGroup::canAddSU(SUnit &SU) const {
     ++E;
 
   // Return true if all of the bundled MIs can be added to this group.
-  return std::all_of(B, E, [this](MachineInstr &MI) { return canAddMI(MI); });
+  return std::all_of(B, E, [this](MachineInstr &MI) {
+    return (MI.isMetaInstruction()) || canAddMI(MI);
----------------
arsenm wrote:

The basic change LGTM. Though the code structure here is now unnecessarily confusing and could be cleaned up in a follow up. Inside canAddMI already tries to handle isMetaInstruction. The code here is also pre-finding the bounds of the bundle prior to doing the all_of. You can remove the isMetaInstruction inside of canAddMI, and directly check canAddMI in the initial walk through the bundle above 

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


More information about the llvm-commits mailing list