[llvm] MachineScheduler: Improve instruction clustering (PR #137784)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 4 03:00:00 PDT 2025


================
@@ -70,6 +75,14 @@ bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
   if (!DAG.addEdge(&SecondSU, SDep(&FirstSU, SDep::Cluster)))
     return false;
 
+  auto &Clusters = DAG.getClusters();
+
+  FirstSU.ParentClusterIdx = Clusters.size();
+  SecondSU.ParentClusterIdx = Clusters.size();
+
+  SmallSet<SUnit *, 8> Cluster{{&FirstSU, &SecondSU}};
+  Clusters.emplace_back(Cluster);
----------------
jayfoad wrote:

Weird use of "emplace". Can you write it more like `emplace_back({&FirstSU, &SecondSU})`? Or failing that, just use `push_back`?

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


More information about the llvm-commits mailing list