diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-10-27 00:56:56 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-10-27 00:56:56 +0000 |
commit | 21a9a98b77c48fb5084d3ef470083704d13c3929 (patch) | |
tree | a48d655cd40d51fb5147ac11d837c4929348b8ec /test | |
parent | 4618e0b574bf879d062a39b5867d9c314a4639e0 (diff) | |
download | llvm-21a9a98b77c48fb5084d3ef470083704d13c3929.tar.gz llvm-21a9a98b77c48fb5084d3ef470083704d13c3929.tar.bz2 llvm-21a9a98b77c48fb5084d3ef470083704d13c3929.tar.xz |
[mips] Do not tail-call optimize vararg functions or functions with byval
arguments.
This is rather conservative and should be fixed later to be more aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166851 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/Mips/tailcall.ll | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/tailcall.ll b/test/CodeGen/Mips/tailcall.ll index 4989636a20..e82b1e3d51 100644 --- a/test/CodeGen/Mips/tailcall.ll +++ b/test/CodeGen/Mips/tailcall.ll @@ -66,9 +66,15 @@ declare i32 @callee4(i32, i32, i32, i32, i32, i32, i32, i32, i32) define i32 @caller5() nounwind readonly { entry: +; PIC32: .ent caller5 ; PIC32-NOT: jalr +; PIC32: .end caller5 +; STATIC32: .ent caller5 ; STATIC32-NOT: jal +; STATIC32: .end caller5 +; N64: .ent caller5 ; N64-NOT: jalr +; N64: .end caller5 %0 = load i32* @g0, align 4 %1 = load i32* @g1, align 4 @@ -98,3 +104,55 @@ entry: ret i32 %add8 } +declare i32 @callee8(i32, ...) + +define i32 @caller8_0() nounwind { +entry: + %call = tail call fastcc i32 @caller8_1() + ret i32 %call +} + +define internal fastcc i32 @caller8_1() nounwind noinline { +entry: +; PIC32: .ent caller8_1 +; PIC32: jalr +; PIC32: .end caller8_1 +; STATIC32: .ent caller8_1 +; STATIC32: jal +; STATIC32: .end caller8_1 +; N64: .ent caller8_1 +; N64: jalr +; N64: .end caller8_1 + + %call = tail call i32 (i32, ...)* @callee8(i32 2, i32 1) nounwind + ret i32 %call +} + +%struct.S = type { [2 x i32] } + +@gs1 = external global %struct.S + +declare i32 @callee9(%struct.S* byval) + +define i32 @caller9_0() nounwind { +entry: + %call = tail call fastcc i32 @caller9_1() + ret i32 %call +} + +define internal fastcc i32 @caller9_1() nounwind noinline { +entry: +; PIC32: .ent caller9_1 +; PIC32: jalr +; PIC32: .end caller9_1 +; STATIC32: .ent caller9_1 +; STATIC32: jal +; STATIC32: .end caller9_1 +; N64: .ent caller9_1 +; N64: jalr +; N64: .end caller9_1 + + %call = tail call i32 @callee9(%struct.S* byval @gs1) nounwind + ret i32 %call +} + |