1 ; RUN: opt < %s -passes=inline -S | FileCheck %s
2 ; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
3 ; RUN: opt < %s -passes='module-inline' -S | FileCheck %s
4 ; Test that bar and bar2 are both inlined throughout and removed.
5 @A = weak global i32 0 ; <ptr> [#uses=1]
6 @B = weak global i32 0 ; <ptr> [#uses=1]
7 @C = weak global i32 0 ; <ptr> [#uses=1]
9 define fastcc void @foo(i32 %X) {
12 %ALL = alloca i32, align 4 ; <ptr> [#uses=1]
13 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
14 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
15 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
17 cond_true: ; preds = %entry
21 cond_next: ; preds = %cond_true, %entry
22 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
23 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
24 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
26 cond_true5: ; preds = %cond_next
30 cond_next7: ; preds = %cond_true5, %cond_next
31 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
32 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
33 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
35 cond_true11: ; preds = %cond_next7
39 cond_next13: ; preds = %cond_true11, %cond_next7
40 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
41 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
42 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
44 cond_true17: ; preds = %cond_next13
45 call void @ext( ptr %ALL )
48 UnifiedReturnBlock: ; preds = %cond_next13
53 define internal fastcc void @bar(i32 %X) {
55 %ALL = alloca i32, align 4 ; <ptr> [#uses=1]
56 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
57 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
58 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
60 cond_true: ; preds = %entry
64 cond_next: ; preds = %cond_true, %entry
65 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
66 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
67 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
69 cond_true5: ; preds = %cond_next
73 cond_next7: ; preds = %cond_true5, %cond_next
74 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
75 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
76 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
78 cond_true11: ; preds = %cond_next7
82 cond_next13: ; preds = %cond_true11, %cond_next7
83 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
84 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
85 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
87 cond_true17: ; preds = %cond_next13
88 call void @foo( i32 %X )
91 UnifiedReturnBlock: ; preds = %cond_next13
95 define internal fastcc void @bar2(i32 %X) {
97 call void @foo( i32 %X )
101 declare void @ext(ptr)
103 define void @test(i32 %X) {
107 tail call fastcc void @bar( i32 %X )
108 tail call fastcc void @bar( i32 %X )
109 tail call fastcc void @bar2( i32 %X )
110 tail call fastcc void @bar2( i32 %X )