Skip to content

Commit 847b5e2

Browse files
committed
[PowerPC] Use getSignedTargetConstant in SelectOptimalAddrMode.
Fixes llvm#127298.
1 parent c30a7f4 commit 847b5e2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19110,8 +19110,8 @@ PPC::AddrMode PPCTargetLowering::SelectOptimalAddrMode(const SDNode *Parent,
1911019110
int32_t Addr = (int32_t)CNImm;
1911119111
// Otherwise, break this down into LIS + Disp.
1911219112
Disp = DAG.getSignedTargetConstant((int16_t)Addr, DL, MVT::i32);
19113-
Base =
19114-
DAG.getTargetConstant((Addr - (int16_t)Addr) >> 16, DL, MVT::i32);
19113+
Base = DAG.getSignedTargetConstant((Addr - (int16_t)Addr) >> 16, DL,
19114+
MVT::i32);
1911519115
uint32_t LIS = CNType == MVT::i32 ? PPC::LIS : PPC::LIS8;
1911619116
Base = SDValue(DAG.getMachineNode(LIS, DL, CNType, Base), 0);
1911719117
break;

llvm/test/CodeGen/PowerPC/pr127298.ll

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; RUN: llc < %s -mtriple=powerpc | FileCheck %s
2+
3+
define void @foo() {
4+
Entry:
5+
%0 = load volatile i8, ptr inttoptr (i32 -559038737 to ptr), align 1
6+
ret void
7+
}

0 commit comments

Comments
 (0)