https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/160484
>From f588d48f0e41e7c28bd5f5ff9f7c8c673f9310b2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Wed, 24 Sep 2025 19:02:49 +0900 Subject: [PATCH] Greedy: Move physreg check when trying to recolor vregs (NFC) Instead of checking if the recoloring candidate is a virtual register, avoid adding it to the candidates in the first place. --- llvm/lib/CodeGen/RegAllocGreedy.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp index 6e0585b2e9e55..dc23ab3ce9d2b 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.cpp +++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp @@ -2502,10 +2502,6 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) { do { Reg = RecoloringCandidates.pop_back_val(); - // We cannot recolor physical register. - if (Reg.isPhysical()) - continue; - // This may be a skipped register. if (!VRM->hasPhys(Reg)) { assert(!shouldAllocateRegister(Reg) && @@ -2553,7 +2549,8 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) { // Push all copy-related live-ranges to keep reconciling the broken // hints. for (const HintInfo &HI : Info) { - if (Visited.insert(HI.Reg).second) + // We cannot recolor physical register. + if (HI.Reg.isVirtual() && Visited.insert(HI.Reg).second) RecoloringCandidates.push_back(HI.Reg); } } while (!RecoloringCandidates.empty()); _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
