xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/tailcall-disable.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -disable-tail-calls < %s | FileCheck --check-prefix=CALL %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck --check-prefix=JMP %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workertarget 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*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine i32 @helper() nounwind {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  ret i32 7
10*9880d681SAndroid Build Coastguard Worker}
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine i32 @test1() nounwind {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @helper()
15*9880d681SAndroid Build Coastguard Worker  ret i32 %call
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; CALL-LABEL: test1:
19*9880d681SAndroid Build Coastguard Worker; CALL-NOT: ret
20*9880d681SAndroid Build Coastguard Worker; CALL: callq helper
21*9880d681SAndroid Build Coastguard Worker; CALL: ret
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; JMP-LABEL: test1:
24*9880d681SAndroid Build Coastguard Worker; JMP-NOT: ret
25*9880d681SAndroid Build Coastguard Worker; JMP: jmp helper # TAILCALL
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdefine i32 @test2() nounwind {
28*9880d681SAndroid Build Coastguard Workerentry:
29*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @test2()
30*9880d681SAndroid Build Coastguard Worker  ret i32 %call
31*9880d681SAndroid Build Coastguard Worker}
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker; CALL-LABEL: test2:
34*9880d681SAndroid Build Coastguard Worker; CALL-NOT: ret
35*9880d681SAndroid Build Coastguard Worker; CALL: callq test2
36*9880d681SAndroid Build Coastguard Worker; CALL: ret
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; JMP-LABEL: test2:
39*9880d681SAndroid Build Coastguard Worker; JMP-NOT: ret
40*9880d681SAndroid Build Coastguard Worker; JMP: jmp test2 # TAILCALL
41