[llvm] db59def - [ThumbRegisterInfo] Use getSigned() for constant pool loads
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 07:05:52 PST 2025
Author: Nikita Popov
Date: 2025-12-09T16:03:08+01:00
New Revision: db59def3b88410f0abd66c601153c8db7cb2dc57
URL: https://github.com/llvm/llvm-project/commit/db59def3b88410f0abd66c601153c8db7cb2dc57
DIFF: https://github.com/llvm/llvm-project/commit/db59def3b88410f0abd66c601153c8db7cb2dc57.diff
LOG: [ThumbRegisterInfo] Use getSigned() for constant pool loads
To match the signed int parameter for the value.
Added:
Modified:
llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp b/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
index 12875c233312a..85e705d4c5e24 100644
--- a/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ThumbRegisterInfo.cpp
@@ -66,8 +66,8 @@ static void emitThumb1LoadConstPool(MachineBasicBlock &MBB,
const ARMSubtarget &STI = MF.getSubtarget<ARMSubtarget>();
const TargetInstrInfo &TII = *STI.getInstrInfo();
MachineConstantPool *ConstantPool = MF.getConstantPool();
- const Constant *C = ConstantInt::get(
- Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
+ const Constant *C = ConstantInt::getSigned(
+ Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align(4));
BuildMI(MBB, MBBI, dl, TII.get(ARM::tLDRpci))
@@ -85,8 +85,8 @@ static void emitThumb2LoadConstPool(MachineBasicBlock &MBB,
MachineFunction &MF = *MBB.getParent();
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
MachineConstantPool *ConstantPool = MF.getConstantPool();
- const Constant *C = ConstantInt::get(
- Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
+ const Constant *C = ConstantInt::getSigned(
+ Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align(4));
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2LDRpci))
More information about the llvm-commits
mailing list