xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/disable-tail-calls.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march x86-64 | FileCheck %s --check-prefix=NO-OPTION
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march x86-64 -disable-tail-calls | FileCheck %s --check-prefix=DISABLE-TRUE
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march x86-64 -disable-tail-calls=false | FileCheck %s --check-prefix=DISABLE-FALSE
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Check that command line option "-disable-tail-calls" overrides function
6*9880d681SAndroid Build Coastguard Worker; attribute "disable-tail-calls".
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; NO-OPTION-LABEL: {{\_?}}func_attr
9*9880d681SAndroid Build Coastguard Worker; NO-OPTION: callq {{\_?}}callee
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; DISABLE-FALSE-LABEL: {{\_?}}func_attr
12*9880d681SAndroid Build Coastguard Worker; DISABLE-FALSE: jmp {{\_?}}callee
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; DISABLE-TRUE-LABEL: {{\_?}}func_attr
15*9880d681SAndroid Build Coastguard Worker; DISABLE-TRUE: callq {{\_?}}callee
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine i32 @func_attr(i32 %a) #0 {
18*9880d681SAndroid Build Coastguard Workerentry:
19*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @callee(i32 %a)
20*9880d681SAndroid Build Coastguard Worker  ret i32 %call
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; NO-OPTION-LABEL: {{\_?}}func_noattr
24*9880d681SAndroid Build Coastguard Worker; NO-OPTION: jmp {{\_?}}callee
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; DISABLE-FALSE-LABEL: {{\_?}}func_noattr
27*9880d681SAndroid Build Coastguard Worker; DISABLE-FALSE: jmp {{\_?}}callee
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; DISABLE-TRUE-LABEL: {{\_?}}func_noattr
30*9880d681SAndroid Build Coastguard Worker; DISABLE-TRUE: callq {{\_?}}callee
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdefine i32 @func_noattr(i32 %a) {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker  %call = tail call i32 @callee(i32 %a)
35*9880d681SAndroid Build Coastguard Worker  ret i32 %call
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdeclare i32 @callee(i32)
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerattributes #0 = { "disable-tail-calls"="true" }
41