1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[PowerPC] Remove extra nop after notoc call

Calls that are marked as @notoc do not require the extra nop after the call
for the TOC restore.

Differential Revision: https://reviews.llvm.org/D81081
This commit is contained in:
Stefan Pintilie 2020-06-05 06:37:21 -05:00
parent 5e3af5dc50
commit dcc68e4eb3
2 changed files with 27 additions and 3 deletions

View File

@ -145,9 +145,9 @@ let isCall = 1, PPC970_Unit = 7, Defs = [LR8] in {
// it does use R2 then it is just a caller saved register. Therefore it is
// safe to emit only the bl and not the nop for this instruction. The
// linker will not try to restore R2 after the call.
def BL8_NOTOC : IForm_and_DForm_4_zero<18, 0, 1, 24, (outs),
(ins calltarget:$func),
"bl $func", IIC_BrB, []>;
def BL8_NOTOC : IForm<18, 0, 1, (outs),
(ins calltarget:$func),
"bl $func", IIC_BrB, []>;
}
}
let Uses = [CTR8, RM] in {

View File

@ -36,3 +36,27 @@ entry:
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg)
; CHECK-S-LABEL: callerNoTail
; CHECK-S: bl callee@notoc
; CHECK-S-NOT: nop
; CHECK-S: bl callee@notoc
; CHECK-S-NOT: nop
; CHECK-S: blr
; CHECK-O-LABEL: callerNoTail
; CHECK-O: bl
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
; CHECK-O-NOT: nop
; CHECK-O: bl
; CHECK-O-NEXT: R_PPC64_REL24_NOTOC callee
; CHECK-O-NOT: nop
; CHECK-O: blr
define dso_local signext i32 @callerNoTail() local_unnamed_addr {
entry:
%call1 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
%call2 = tail call signext i32 bitcast (i32 (...)* @callee to i32 ()*)()
%add = add i32 %call1, %call2
ret i32 %add
}