blob: 6ed5c2abc190aa698636d1bfaf9ad9639cffd903 [file] [log] [blame]
Mandeep Singh Grangddcb9562018-05-23 22:44:08 +00001; Check that command line option "-disable-tail-calls" overrides function
2; attribute "disable-tail-calls".
3
4; RUN: llc < %s -mtriple=riscv32-unknown-elf \
5; RUN: | FileCheck %s --check-prefixes=CALLER1,NOTAIL
6; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls \
7; RUN: | FileCheck %s --check-prefixes=CALLER1,NOTAIL
8; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls=false \
9; RUN: | FileCheck %s --check-prefixes=CALLER1,TAIL
10
11; RUN: llc < %s -mtriple=riscv32-unknown-elf \
12; RUN: | FileCheck %s --check-prefixes=CALLER2,TAIL
13; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls \
14; RUN: | FileCheck %s --check-prefixes=CALLER2,NOTAIL
15; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls=false \
16; RUN: | FileCheck %s --check-prefixes=CALLER2,TAIL
17
18; RUN: llc < %s -mtriple=riscv32-unknown-elf \
19; RUN: | FileCheck %s --check-prefixes=CALLER3,TAIL
20; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls \
21; RUN: | FileCheck %s --check-prefixes=CALLER3,NOTAIL
22; RUN: llc < %s -mtriple=riscv32-unknown-elf -disable-tail-calls=false \
23; RUN: | FileCheck %s --check-prefixes=CALLER3,TAIL
24
25; CALLER1-LABEL: {{\_?}}caller1
26; CALLER2-LABEL: {{\_?}}caller2
27; CALLER3-LABEL: {{\_?}}caller3
28; NOTAIL-NOT: tail callee
29; NOTAIL: call callee
30; TAIL: tail callee
31; TAIL-NOT: call callee
32
33; Function with attribute #0 = { "disable-tail-calls"="true" }
34define i32 @caller1(i32 %a) #0 {
35entry:
36 %call = tail call i32 @callee(i32 %a)
37 ret i32 %call
38}
39
40; Function with attribute #1 = { "disable-tail-calls"="false" }
41define i32 @caller2(i32 %a) #0 {
42entry:
43 %call = tail call i32 @callee(i32 %a)
44 ret i32 %call
45}
46
47define i32 @caller3(i32 %a) {
48entry:
49 %call = tail call i32 @callee(i32 %a)
50 ret i32 %call
51}
52
53declare i32 @callee(i32)
54
55attributes #0 = { "disable-tail-calls"="true" }
56attributes #1 = { "disable-tail-calls"="false" }