summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/Mips/tailcall.ll
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-10-30 20:16:31 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-10-30 20:16:31 +0000
commit2f34d754d00fbe2e4a98762d71d0fae5f4b0cf45 (patch)
tree4363eef803f374eb502a65e87910b47744c5e8ec /test/CodeGen/Mips/tailcall.ll
parentdfa4cecb1e549d96f800f7ebc793a342d8df1244 (diff)
downloadexternal_llvm-2f34d754d00fbe2e4a98762d71d0fae5f4b0cf45.zip
external_llvm-2f34d754d00fbe2e4a98762d71d0fae5f4b0cf45.tar.gz
external_llvm-2f34d754d00fbe2e4a98762d71d0fae5f4b0cf45.tar.bz2
[mips] Allow tail-call optimization for vararg functions and functions which
use the caller's stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167048 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Mips/tailcall.ll')
-rw-r--r--test/CodeGen/Mips/tailcall.ll66
1 files changed, 65 insertions, 1 deletions
diff --git a/test/CodeGen/Mips/tailcall.ll b/test/CodeGen/Mips/tailcall.ll
index e82b1e3..f1aca68 100644
--- a/test/CodeGen/Mips/tailcall.ll
+++ b/test/CodeGen/Mips/tailcall.ll
@@ -121,7 +121,7 @@ entry:
; STATIC32: jal
; STATIC32: .end caller8_1
; N64: .ent caller8_1
-; N64: jalr
+; N64-NOT: jalr
; N64: .end caller8_1
%call = tail call i32 (i32, ...)* @callee8(i32 2, i32 1) nounwind
@@ -156,3 +156,67 @@ entry:
ret i32 %call
}
+declare i32 @callee10(i32, i32, i32, i32, i32, i32, i32, i32, i32)
+
+define i32 @caller10(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, i32 %a6, i32 %a7, i32 %a8) nounwind {
+entry:
+; PIC32: .ent caller10
+; PIC32-NOT: jalr
+; STATIC32: .ent caller10
+; STATIC32-NOT: jal
+; N64: .ent caller10
+; N64-NOT: jalr
+
+ %call = tail call i32 @callee10(i32 %a8, i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4, i32 %a5, i32 %a6, i32 %a7) nounwind
+ ret i32 %call
+}
+
+declare i32 @callee11(%struct.S* byval)
+
+define i32 @caller11() nounwind noinline {
+entry:
+; PIC32: .ent caller11
+; PIC32: jalr
+; STATIC32: .ent caller11
+; STATIC32: jal
+; N64: .ent caller11
+; N64: jalr
+
+ %call = tail call i32 @callee11(%struct.S* byval @gs1) nounwind
+ ret i32 %call
+}
+
+declare i32 @callee12()
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
+
+define i32 @caller12(%struct.S* nocapture byval %a0) nounwind {
+entry:
+; PIC32: .ent caller12
+; PIC32: jalr
+; STATIC32: .ent caller12
+; STATIC32: jal
+; N64: .ent caller12
+; N64: jalr
+
+ %0 = bitcast %struct.S* %a0 to i8*
+ tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast (%struct.S* @gs1 to i8*), i8* %0, i32 8, i32 4, i1 false)
+ %call = tail call i32 @callee12() nounwind
+ ret i32 %call
+}
+
+declare i32 @callee13(i32, ...)
+
+define i32 @caller13() nounwind {
+entry:
+; PIC32: .ent caller13
+; PIC32-NOT: jalr
+; STATIC32: .ent caller13
+; STATIC32-NOT: jal
+; N64: .ent caller13
+; N64-NOT: jalr
+
+ %call = tail call i32 (i32, ...)* @callee13(i32 1, i32 2) nounwind
+ ret i32 %call
+}
+