llvm.org GIT mirror llvm / 0676984
merge two tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112617 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 35 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
3636 ; CHECK: define i32 @test2_mul
3737 ; CHECK: phi i32
3838 ; CHECK-NOT: call i32
39 ; CHECK: return:
39 ; CHECK: return:
40
41
42 define i64 @test3_fib(i64 %n) nounwind readnone {
43 ; CHECK: @test3_fib
44 entry:
45 ; CHECK: tailrecurse:
46 ; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ]
47 ; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ]
48 switch i64 %n, label %bb1 [
49 ; CHECK: switch i64 %n.tr, label %bb1 [
50 i64 0, label %bb2
51 i64 1, label %bb2
52 ]
53
54 bb1:
55 ; CHECK: bb1:
56 %0 = add i64 %n, -1
57 ; CHECK: %0 = add i64 %n.tr, -1
58 %1 = tail call i64 @test3_fib(i64 %0) nounwind
59 ; CHECK: %1 = tail call i64 @test3_fib(i64 %0)
60 %2 = add i64 %n, -2
61 ; CHECK: %2 = add i64 %n.tr, -2
62 %3 = tail call i64 @test3_fib(i64 %2) nounwind
63 ; CHECK-NOT: tail call i64 @test3_fib
64 %4 = add nsw i64 %3, %1
65 ; CHECK: add nsw i64 %accumulator.tr, %1
66 ret i64 %4
67 ; CHECK: br label %tailrecurse
68
69 bb2:
70 ; CHECK: bb2:
71 ret i64 %n
72 ; CHECK: ret i64 %accumulator.tr
73 }
+0
-34
test/Transforms/TailCallElim/switch.ll less more
None ; RUN: opt %s -tailcallelim -S | FileCheck %s
1
2 define i64 @fib(i64 %n) nounwind readnone {
3 ; CHECK: @fib
4 entry:
5 ; CHECK: tailrecurse:
6 ; CHECK: %accumulator.tr = phi i64 [ %n, %entry ], [ %3, %bb1 ]
7 ; CHECK: %n.tr = phi i64 [ %n, %entry ], [ %2, %bb1 ]
8 switch i64 %n, label %bb1 [
9 ; CHECK: switch i64 %n.tr, label %bb1 [
10 i64 0, label %bb2
11 i64 1, label %bb2
12 ]
13
14 bb1:
15 ; CHECK: bb1:
16 %0 = add i64 %n, -1
17 ; CHECK: %0 = add i64 %n.tr, -1
18 %1 = tail call i64 @fib(i64 %0) nounwind
19 ; CHECK: %1 = tail call i64 @fib(i64 %0)
20 %2 = add i64 %n, -2
21 ; CHECK: %2 = add i64 %n.tr, -2
22 %3 = tail call i64 @fib(i64 %2) nounwind
23 ; CHECK-NOT: tail call i64 @fib
24 %4 = add nsw i64 %3, %1
25 ; CHECK: add nsw i64 %accumulator.tr, %1
26 ret i64 %4
27 ; CHECK: br label %tailrecurse
28
29 bb2:
30 ; CHECK: bb2:
31 ret i64 %n
32 ; CHECK: ret i64 %accumulator.tr
33 }