[llvm] [MacroFusion] Call Clusters.size() once before assignments (NFC) (PR #192396)

Tomer Shafir via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 23:01:39 PDT 2026


https://github.com/tomershafir updated https://github.com/llvm/llvm-project/pull/192396

>From fd8212ab6951e7943da01ae938ac758d953c32b5 Mon Sep 17 00:00:00 2001
From: tomershafir <tomer.shafir8 at gmail.com>
Date: Mon, 13 Apr 2026 20:13:09 +0300
Subject: [PATCH] [MacroFusion] Call Clusters.size() once before assignments
 (NFC)

---
 llvm/lib/CodeGen/MacroFusion.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/CodeGen/MacroFusion.cpp b/llvm/lib/CodeGen/MacroFusion.cpp
index 48448c8e82b58..08f4c59b29d26 100644
--- a/llvm/lib/CodeGen/MacroFusion.cpp
+++ b/llvm/lib/CodeGen/MacroFusion.cpp
@@ -77,8 +77,9 @@ bool llvm::fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU,
 
   auto &Clusters = DAG.getClusters();
 
-  FirstSU.ParentClusterIdx = Clusters.size();
-  SecondSU.ParentClusterIdx = Clusters.size();
+  unsigned ClusterIdx = Clusters.size();
+  FirstSU.ParentClusterIdx = ClusterIdx;
+  SecondSU.ParentClusterIdx = ClusterIdx;
 
   SmallPtrSet<SUnit *, 8> Cluster{{&FirstSU, &SecondSU}};
   Clusters.push_back(Cluster);



More information about the llvm-commits mailing list