Nick Lewycky | 22de16d | 2012-01-19 00:34:10 +0000 | [diff] [blame] | 1 | ; RUN: llc -disable-tail-calls < %s | FileCheck --check-prefix=CALL %s |
| 2 | ; RUN: llc < %s | FileCheck --check-prefix=JMP %s |
| 3 | |
| 4 | target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" |
| 5 | target triple = "x86_64-unknown-linux-gnu" |
| 6 | |
| 7 | define i32 @helper() nounwind { |
| 8 | entry: |
| 9 | ret i32 7 |
| 10 | } |
| 11 | |
| 12 | define i32 @test1() nounwind { |
| 13 | entry: |
| 14 | %call = tail call i32 @helper() |
| 15 | ret i32 %call |
| 16 | } |
| 17 | |
Nick Lewycky | 2faa5d2 | 2012-01-19 01:13:47 +0000 | [diff] [blame] | 18 | ; CALL: test1: |
| 19 | ; CALL-NOT: ret |
| 20 | ; CALL: callq helper |
| 21 | ; CALL: ret |
Nick Lewycky | 22de16d | 2012-01-19 00:34:10 +0000 | [diff] [blame] | 22 | |
Nick Lewycky | 2faa5d2 | 2012-01-19 01:13:47 +0000 | [diff] [blame] | 23 | ; JMP: test1: |
| 24 | ; JMP-NOT: ret |
| 25 | ; JMP: jmp helper # TAILCALL |
Nick Lewycky | 22de16d | 2012-01-19 00:34:10 +0000 | [diff] [blame] | 26 | |
| 27 | define i32 @test2() nounwind { |
| 28 | entry: |
| 29 | %call = tail call i32 @test2() |
| 30 | ret i32 %call |
| 31 | } |
| 32 | |
Nick Lewycky | 2faa5d2 | 2012-01-19 01:13:47 +0000 | [diff] [blame] | 33 | ; CALL: test2: |
| 34 | ; CALL-NOT: ret |
| 35 | ; CALL: callq test2 |
| 36 | ; CALL: ret |
Nick Lewycky | 22de16d | 2012-01-19 00:34:10 +0000 | [diff] [blame] | 37 | |
Nick Lewycky | 2faa5d2 | 2012-01-19 01:13:47 +0000 | [diff] [blame] | 38 | ; JMP: test2: |
| 39 | ; JMP-NOT: ret |
| 40 | ; JMP: jmp test2 # TAILCALL |