Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5473,10 +5473,10 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
// generate secure plt code for TLS symbols.
getGlobalBaseReg();
} break;
case PPCISD::CALL: {
if (PPCLowering->getPointerTy(CurDAG->getDataLayout()) != MVT::i32 ||
!TM.isPositionIndependent() || !Subtarget->isSecurePlt() ||
!Subtarget->isTargetELF())
case PPCISD::CALL:
case PPCISD::CALL_RM: {
if (Subtarget->isPPC64() || !TM.isPositionIndependent() ||
!Subtarget->isSecurePlt() || !Subtarget->isTargetELF())
break;

SDValue Op = N->getOperand(1);
Expand All @@ -5489,8 +5489,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
if (ES->getTargetFlags() == PPCII::MO_PLT)
getGlobalBaseReg();
}
}
break;
} break;

case PPCISD::GlobalBaseReg:
ReplaceNode(N, getGlobalBaseReg());
Expand Down
44 changes: 44 additions & 0 deletions llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ $bar1 = comdat any
@bar2 = global i32 0, align 4, comdat($bar1)

declare i32 @call_foo(i32, ...)
declare i32 @call_strictfp() strictfp
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg)

define i32 @foo() {
entry:
Expand All @@ -21,6 +23,23 @@ entry:
ret i32 %0
}

define i32 @foo1() strictfp {
entry:
%call = call i32 (i32, ...) @call_foo(i32 0)
ret i32 %call
}

define i32 @foo1_strictfp() strictfp {
entry:
%call = call i32 () @call_strictfp()
ret i32 %call
}

define void @foo2(ptr %a) {
call void @llvm.memset.p0.i64(ptr align 1 %a, i8 1, i64 1000, i1 false)
ret void
}

define i32 @load() {
entry:
%0 = load i32, ptr @bar1
Expand Down Expand Up @@ -49,6 +68,31 @@ entry:
; LARGE-SECUREPLT: addi 30, 30, .LTOC-.L0$pb@l
; LARGE-SECUREPLT: bl call_foo@PLT+32768

; LARGE-SECUREPLT-LABEL: foo1:
; LARGE-SECUREPLT: .L1$pb:
; LARGE-SECUREPLT-NEXT: crxor 6, 6, 6
; LARGE-SECUREPLT-NEXT: mflr 30
; LARGE-SECUREPLT-NEXT: addis 30, 30, .LTOC-.L1$pb@ha
; LARGE-SECUREPLT-NEXT: addi 30, 30, .LTOC-.L1$pb@l
; LARGE-SECUREPLT-NEXT: li 3, 0
; LARGE-SECUREPLT-NEXT: bl call_foo@PLT+32768

; LARGE-SECUREPLT-LABEL: foo1_strictfp:
; LARGE-SECUREPLT: .L2$pb:
; LARGE-SECUREPLT-NEXT: mflr 30
; LARGE-SECUREPLT-NEXT: addis 30, 30, .LTOC-.L2$pb@ha
; LARGE-SECUREPLT-NEXT: addi 30, 30, .LTOC-.L2$pb@l
; LARGE-SECUREPLT-NEXT: bl call_strictfp@PLT+32768

; LARGE-SECUREPLT-LABEL: foo2:
; LARGE-SECUREPLT: .L3$pb:
; LARGE-SECUREPLT: mflr 30
; LARGE-SECUREPLT-NEXT: addis 30, 30, .LTOC-.L3$pb@ha
; LARGE-SECUREPLT-NEXT: addi 30, 30, .LTOC-.L3$pb@l
; LARGE-SECUREPLT: bl memset@PLT+32768

; LARGE-SECUREPLT-LABEEL: load:

; LARGE: .section .bss.bar1,"awG",@nobits,bar1,comdat
; LARGE: bar1:
; LARGE: .section .bss.bar2,"awG",@nobits,bar1,comdat
Expand Down
Loading