[llvm] [RISCV] Don't add Zilsd pairing hints if part of the pair is reserved. (PR #169538)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 09:56:04 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/169538.diff
1 Files Affected:
- (modified) llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp (+3-5)
``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
index 263d6a1fc2220..a5aef4bea46ab 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
@@ -895,11 +895,9 @@ bool RISCVRegisterInfo::getRegAllocationHints(
// Check if this register matches the even/odd requirement
bool IsOdd = (RegNum % 2 != 0);
- // Verify the pair register exists and is in the same register class
- // TODO: Skip unallocatable registers: we need to prevent any of odd/even
- // to be reserved, so if we need odd, we need to check if corresponding
- // even is preserved, vice versa.
- if ((WantOdd && IsOdd) || (!WantOdd && !IsOdd))
+ // Don't provide hints that are paired to a reserved register.
+ MCRegister Paired = PhysReg + (IsOdd ? -1 : 1);
+ if (WantOdd == IsOdd && !MRI->isReserved(Paired))
Hints.push_back(PhysReg);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/169538
More information about the llvm-commits
mailing list