[llvm] c4e1bca - Greedy: Move physreg check when trying to recolor vregs (NFC) (#160484)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 06:24:53 PDT 2025
Author: Matt Arsenault
Date: 2025-10-02T22:24:49+09:00
New Revision: c4e1bca407f4cca7644937c117890fad157fec4b
URL: https://github.com/llvm/llvm-project/commit/c4e1bca407f4cca7644937c117890fad157fec4b
DIFF: https://github.com/llvm/llvm-project/commit/c4e1bca407f4cca7644937c117890fad157fec4b.diff
LOG: Greedy: Move physreg check when trying to recolor vregs (NFC) (#160484)
Instead of checking if the recoloring candidate is a virtual register,
avoid adding it to the candidates in the first place.
Added:
Modified:
llvm/lib/CodeGen/RegAllocGreedy.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 5638f98b8163d..24fe838e4b7d8 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -2498,10 +2498,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) &&
@@ -2549,7 +2545,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());
More information about the llvm-commits
mailing list