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

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 00:17:00 PDT 2025


================
@@ -61,6 +61,11 @@ bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
   for (SDep &SI : SecondSU.Preds)
     if (SI.isCluster())
       return false;
+
----------------
ruiling wrote:

It is a little bit confusing here. The "cluster" weak edge actually does not function as before. I thought about removing them at very first, but it is hard to detect like:
```
  // Check that neither instr is already paired with another along the edge
  // between them."
```
We only keep the set of SUnit in a cluster group, no order anymore, so we cannot detect "the edge between them". I am not sure whether it is important to check for this pattern. Maybe we just need to check that they are not being clustered with anyone else? I don't have clear answer yet. So, I still keep the "cluster" weak edge. But the way nodes will be clustered during scheduling will only be determined by the `Clusters` in the `DAG`. Maybe we can cleanup it later if people have clear idea how to best handle this.


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


More information about the llvm-commits mailing list