Skip to content

Commit db59def

Browse files
committed
[ThumbRegisterInfo] Use getSigned() for constant pool loads
To match the signed int parameter for the value.
1 parent 53ce850 commit db59def

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Target/ARM/ThumbRegisterInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ static void emitThumb1LoadConstPool(MachineBasicBlock &MBB,
6666
const ARMSubtarget &STI = MF.getSubtarget<ARMSubtarget>();
6767
const TargetInstrInfo &TII = *STI.getInstrInfo();
6868
MachineConstantPool *ConstantPool = MF.getConstantPool();
69-
const Constant *C = ConstantInt::get(
70-
Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
69+
const Constant *C = ConstantInt::getSigned(
70+
Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
7171
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align(4));
7272

7373
BuildMI(MBB, MBBI, dl, TII.get(ARM::tLDRpci))
@@ -85,8 +85,8 @@ static void emitThumb2LoadConstPool(MachineBasicBlock &MBB,
8585
MachineFunction &MF = *MBB.getParent();
8686
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
8787
MachineConstantPool *ConstantPool = MF.getConstantPool();
88-
const Constant *C = ConstantInt::get(
89-
Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
88+
const Constant *C = ConstantInt::getSigned(
89+
Type::getInt32Ty(MBB.getParent()->getFunction().getContext()), Val);
9090
unsigned Idx = ConstantPool->getConstantPoolIndex(C, Align(4));
9191

9292
BuildMI(MBB, MBBI, dl, TII.get(ARM::t2LDRpci))

0 commit comments

Comments
 (0)