[llvm] [ARM] Prevent converting virtual register to MCRegister. (PR #122862)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 21:48:24 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
MCRegister should only be used for physical reigsters.
---
Full diff: https://github.com/llvm/llvm-project/pull/122862.diff
1 Files Affected:
- (modified) llvm/lib/Target/ARM/ThumbRegisterInfo.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp b/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
index 381ade5c85a65e..4fe4ed47e0081d 100644
--- a/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
@@ -139,7 +139,7 @@ static void emitThumbRegPlusImmInReg(
return;
}
- bool isHigh = !isARMLowRegister(DestReg) ||
+ bool isHigh = DestReg.isVirtual() || !isARMLowRegister(DestReg) ||
(BaseReg != 0 && !isARMLowRegister(BaseReg));
bool isSub = false;
// Subtract doesn't have high register version. Load the negative value
@@ -153,7 +153,7 @@ static void emitThumbRegPlusImmInReg(
Register LdReg = DestReg;
if (DestReg == ARM::SP)
assert(BaseReg == ARM::SP && "Unexpected!");
- if (!isARMLowRegister(DestReg) && !DestReg.isVirtual())
+ if (!DestReg.isVirtual() && !isARMLowRegister(DestReg))
LdReg = MF.getRegInfo().createVirtualRegister(&ARM::tGPRRegClass);
if (NumBytes <= 255 && NumBytes >= 0 && CanChangeCC) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/122862
More information about the llvm-commits
mailing list