[llvm] [MacroFusion] Early return when insts already clustered (PR #191710)
Tomer Shafir via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 03:58:59 PDT 2026
================
@@ -52,22 +55,15 @@ bool llvm::hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit) {
bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
SUnit &SecondSU) {
- // Check that neither instr is already paired with another along the edge
- // between them.
- for (SDep &SI : FirstSU.Succs)
- if (SI.isCluster())
- return false;
-
- for (SDep &SI : SecondSU.Preds)
- if (SI.isCluster())
- return false;
-
- assert(FirstSU.ParentClusterIdx == InvalidClusterId &&
- SecondSU.ParentClusterIdx == InvalidClusterId);
-
- // Though the reachability checks above could be made more generic,
- // perhaps as part of ScheduleDAGInstrs::addEdge(), since such edges are valid,
- // the extra computation cost makes it less interesting in general cases.
+ // Check that neither instr is already associated with a cluster (either
+ // fusion or non-fusion)
+ if (FirstSU.isClustered() || SecondSU.isClustered()) {
+ ++NumFusionConflicts;
+ LLVM_DEBUG(dbgs() << "Fusion conflict: cannot fuse SU(" << FirstSU.NodeNum
+ << ") and SU(" << SecondSU.NodeNum
+ << ") - already clustered\n");
----------------
tomershafir wrote:
So I think printing the `IsClustered` status for both in any case would be a decent solution, keeping the code simple and getting the visibility
https://github.com/llvm/llvm-project/pull/191710
More information about the llvm-commits
mailing list