Skip to content

Commit 19296e2

Browse files
committed
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.
1 parent f98b2e0 commit 19296e2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/RegAllocGreedy.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,10 +2502,6 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
25022502
do {
25032503
Reg = RecoloringCandidates.pop_back_val();
25042504

2505-
// We cannot recolor physical register.
2506-
if (Reg.isPhysical())
2507-
continue;
2508-
25092505
// This may be a skipped register.
25102506
if (!VRM->hasPhys(Reg)) {
25112507
assert(!shouldAllocateRegister(Reg) &&
@@ -2553,7 +2549,8 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
25532549
// Push all copy-related live-ranges to keep reconciling the broken
25542550
// hints.
25552551
for (const HintInfo &HI : Info) {
2556-
if (Visited.insert(HI.Reg).second)
2552+
// We cannot recolor physical register.
2553+
if (HI.Reg.isVirtual() && Visited.insert(HI.Reg).second)
25572554
RecoloringCandidates.push_back(HI.Reg);
25582555
}
25592556
} while (!RecoloringCandidates.empty());

0 commit comments

Comments
 (0)