Skip to content

Commit c4e1bca

Browse files
authored
Greedy: Move physreg check when trying to recolor vregs (NFC) (llvm#160484)
Instead of checking if the recoloring candidate is a virtual register, avoid adding it to the candidates in the first place.
1 parent e48fe76 commit c4e1bca

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
@@ -2498,10 +2498,6 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
24982498
do {
24992499
Reg = RecoloringCandidates.pop_back_val();
25002500

2501-
// We cannot recolor physical register.
2502-
if (Reg.isPhysical())
2503-
continue;
2504-
25052501
// This may be a skipped register.
25062502
if (!VRM->hasPhys(Reg)) {
25072503
assert(!shouldAllocateRegister(Reg) &&
@@ -2549,7 +2545,8 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
25492545
// Push all copy-related live-ranges to keep reconciling the broken
25502546
// hints.
25512547
for (const HintInfo &HI : Info) {
2552-
if (Visited.insert(HI.Reg).second)
2548+
// We cannot recolor physical register.
2549+
if (HI.Reg.isVirtual() && Visited.insert(HI.Reg).second)
25532550
RecoloringCandidates.push_back(HI.Reg);
25542551
}
25552552
} while (!RecoloringCandidates.empty());

0 commit comments

Comments
 (0)