Skip to content

Commit eab23e1

Browse files
authored
[RISCV] Don't add Zilsd pairing hints if other part of the pair is reserved. (#169538)
1 parent 3a27fc4 commit eab23e1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,9 @@ bool RISCVRegisterInfo::getRegAllocationHints(
895895
// Check if this register matches the even/odd requirement
896896
bool IsOdd = (RegNum % 2 != 0);
897897

898-
// Verify the pair register exists and is in the same register class
899-
// TODO: Skip unallocatable registers: we need to prevent any of odd/even
900-
// to be reserved, so if we need odd, we need to check if corresponding
901-
// even is preserved, vice versa.
902-
if ((WantOdd && IsOdd) || (!WantOdd && !IsOdd))
898+
// Don't provide hints that are paired to a reserved register.
899+
MCRegister Paired = PhysReg + (IsOdd ? -1 : 1);
900+
if (WantOdd == IsOdd && !MRI->isReserved(Paired))
903901
Hints.push_back(PhysReg);
904902
}
905903
}

0 commit comments

Comments
 (0)