Skip to content

Commit 706b790

Browse files
authored
Greedy: Merge VirtRegMap queries into one use (NFC) (#160485)
1 parent 047f8c8 commit 706b790

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/RegAllocGreedy.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,8 +2498,10 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
24982498
do {
24992499
Reg = RecoloringCandidates.pop_back_val();
25002500

2501+
MCRegister CurrPhys = VRM->getPhys(Reg);
2502+
25012503
// This may be a skipped register.
2502-
if (!VRM->hasPhys(Reg)) {
2504+
if (!CurrPhys) {
25032505
assert(!shouldAllocateRegister(Reg) &&
25042506
"We have an unallocated variable which should have been handled");
25052507
continue;
@@ -2508,7 +2510,6 @@ void RAGreedy::tryHintRecoloring(const LiveInterval &VirtReg) {
25082510
// Get the live interval mapped with this virtual register to be able
25092511
// to check for the interference with the new color.
25102512
LiveInterval &LI = LIS->getInterval(Reg);
2511-
MCRegister CurrPhys = VRM->getPhys(Reg);
25122513
// Check that the new color matches the register class constraints and
25132514
// that it is free for this live range.
25142515
if (CurrPhys != PhysReg && (!MRI->getRegClass(Reg)->contains(PhysReg) ||

0 commit comments

Comments
 (0)