llvm.org GIT mirror llvm / cd56727
[TRE] Merged several tests into the the test basic.ll. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185723 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Gottesman 6 years ago
5 changed file(s) with 58 addition(s) and 62 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -tailcallelim -S | FileCheck %s
1
2 declare void @noarg()
3 declare void @use(i32*)
4
5 ; Trivial case. Mark @noarg with tail call.
6 define void @test0() {
7 ; CHECK: tail call void @noarg()
8 call void @noarg()
9 ret void
10 }
11
12 ; PR615. Make sure that we do not move the alloca so that it interferes with the tail call.
13 define i32 @test1() {
14 ; CHECK: i32 @test1()
15 ; CHECK-NEXT: alloca
16 %A = alloca i32 ; [#uses=2]
17 store i32 5, i32* %A
18 call void @use(i32* %A)
19 %X = tail call i32 @test1() ; [#uses=1]
20 ret i32 %X
21 }
22
23 ; This function contains intervening instructions which should be moved out of the way
24 define i32 @test2(i32 %X) {
25 ; CHECK: i32 @test2
26 ; CHECK-NOT: call
27 ; CHECK: ret i32
28 entry:
29 %tmp.1 = icmp eq i32 %X, 0 ; [#uses=1]
30 br i1 %tmp.1, label %then.0, label %endif.0
31 then.0: ; preds = %entry
32 %tmp.4 = add i32 %X, 1 ; [#uses=1]
33 ret i32 %tmp.4
34 endif.0: ; preds = %entry
35 %tmp.10 = add i32 %X, -1 ; [#uses=1]
36 %tmp.8 = call i32 @test2(i32 %tmp.10) ; [#uses=1]
37 %DUMMY = add i32 %X, 1 ; [#uses=0]
38 ret i32 %tmp.8
39 }
40
41 ; Though this case seems to be fairly unlikely to occur in the wild, someone
42 ; plunked it into the demo script, so maybe they care about it.
43 define i32 @test3(i32 %c) {
44 ; CHECK: i32 @test3
45 ; CHECK-NOT: call
46 ; CHECK: ret i32 0
47 entry:
48 %tmp.1 = icmp eq i32 %c, 0 ; [#uses=1]
49 br i1 %tmp.1, label %return, label %else
50 else: ; preds = %entry
51 %tmp.5 = add i32 %c, -1 ; [#uses=1]
52 %tmp.3 = call i32 @test3(i32 %tmp.5) ; [#uses=0]
53 ret i32 0
54 return: ; preds = %entry
55 ret i32 0
56 }
57
+0
-18
test/Transforms/TailCallElim/intervening-inst.ll less more
None ; This function contains intervening instructions which should be moved out of the way
1 ; RUN: opt < %s -tailcallelim -S | FileCheck %s
2
3 define i32 @Test(i32 %X) {
4 entry:
5 %tmp.1 = icmp eq i32 %X, 0 ; [#uses=1]
6 br i1 %tmp.1, label %then.0, label %endif.0
7 then.0: ; preds = %entry
8 %tmp.4 = add i32 %X, 1 ; [#uses=1]
9 ret i32 %tmp.4
10 endif.0: ; preds = %entry
11 %tmp.10 = add i32 %X, -1 ; [#uses=1]
12 ; CHECK-NOT: call
13 %tmp.8 = call i32 @Test( i32 %tmp.10 ) ; [#uses=1]
14 %DUMMY = add i32 %X, 1 ; [#uses=0]
15 ret i32 %tmp.8
16 }
17
+0
-15
test/Transforms/TailCallElim/move_alloca_for_tail_call.ll less more
None ; RUN: opt -tailcallelim -S < %s | FileCheck %s
1 ; PR615
2
3 declare void @bar(i32*)
4
5 define i32 @foo() {
6 ; CHECK: i32 @foo()
7 ; CHECK-NEXT: alloca
8 %A = alloca i32 ; [#uses=2]
9 store i32 17, i32* %A
10 call void @bar( i32* %A )
11 %X = tail call i32 @foo( ) ; [#uses=1]
12 ret i32 %X
13 }
14
+0
-18
test/Transforms/TailCallElim/return_constant.ll less more
None ; Though this case seems to be fairly unlikely to occur in the wild, someone
1 ; plunked it into the demo script, so maybe they care about it.
2 ;
3 ; RUN: opt < %s -tailcallelim -S | FileCheck %s
4
5 define i32 @aaa(i32 %c) {
6 entry:
7 %tmp.1 = icmp eq i32 %c, 0 ; [#uses=1]
8 br i1 %tmp.1, label %return, label %else
9 else: ; preds = %entry
10 %tmp.5 = add i32 %c, -1 ; [#uses=1]
11 ; CHECK-NOT: call
12 %tmp.3 = call i32 @aaa( i32 %tmp.5 ) ; [#uses=0]
13 ret i32 0
14 return: ; preds = %entry
15 ret i32 0
16 }
17
+0
-11
test/Transforms/TailCallElim/trivial_codegen_tailcall.ll less more
None ; RUN: opt < %s -tailcallelim -S | FileCheck %s
1
2
3 declare void @foo()
4
5 define void @bar() {
6 ; CHECK: tail call void @foo()
7 call void @foo()
8 ret void
9 }
10