[llvm] f98735f - Greedy: Use initializer list for recoloring candidates (NFC) (#160486)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 2 07:22:24 PDT 2025


Author: Matt Arsenault
Date: 2025-10-02T23:22:20+09:00
New Revision: f98735f1264c9214a2efa2b05d48871e44cfd245

URL: https://github.com/llvm/llvm-project/commit/f98735f1264c9214a2efa2b05d48871e44cfd245
DIFF: https://github.com/llvm/llvm-project/commit/f98735f1264c9214a2efa2b05d48871e44cfd245.diff

LOG: Greedy: Use initializer list for recoloring candidates (NFC) (#160486)

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocGreedy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index f0f313050cf92..803ecdc89bb7a 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -2482,15 +2482,13 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
   // We have a broken hint, check if it is possible to fix it by
   // reusing PhysReg for the copy-related live-ranges. Indeed, we evicted
   // some register and PhysReg may be available for the other live-ranges.
-  SmallSet<Register, 4> Visited;
-  SmallVector<Register, 2> RecoloringCandidates;
   HintsInfo Info;
   Register Reg = VirtReg.reg();
   MCRegister PhysReg = VRM->getPhys(Reg);
   // Start the recoloring algorithm from the input live-interval, then
   // it will propagate to the ones that are copy-related with it.
-  Visited.insert(Reg);
-  RecoloringCandidates.push_back(Reg);
+  SmallSet<Register, 4> Visited = {Reg};
+  SmallVector<Register, 2> RecoloringCandidates = {Reg};
 
   LLVM_DEBUG(dbgs() << "Trying to reconcile hints for: " << printReg(Reg, TRI)
                     << '(' << printReg(PhysReg, TRI) << ")\n");


        


More information about the llvm-commits mailing list