1 ; RUN: opt < %s -inline -S | FileCheck %s
2 ; Test that bar and bar2 are both inlined throughout and removed.
3 @A = weak global i32 0 ; <i32*> [#uses=1]
4 @B = weak global i32 0 ; <i32*> [#uses=1]
5 @C = weak global i32 0 ; <i32*> [#uses=1]
7 define fastcc void @foo(i32 %X) {
10 %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
11 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
12 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
13 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
15 cond_true: ; preds = %entry
19 cond_next: ; preds = %cond_true, %entry
20 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
21 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
22 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
24 cond_true5: ; preds = %cond_next
28 cond_next7: ; preds = %cond_true5, %cond_next
29 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
30 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
31 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
33 cond_true11: ; preds = %cond_next7
37 cond_next13: ; preds = %cond_true11, %cond_next7
38 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
39 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
40 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
42 cond_true17: ; preds = %cond_next13
43 call void @ext( i32* %ALL )
46 UnifiedReturnBlock: ; preds = %cond_next13
51 define internal fastcc void @bar(i32 %X) {
53 %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
54 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
55 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
56 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
58 cond_true: ; preds = %entry
62 cond_next: ; preds = %cond_true, %entry
63 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
64 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
65 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
67 cond_true5: ; preds = %cond_next
71 cond_next7: ; preds = %cond_true5, %cond_next
72 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
73 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
74 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
76 cond_true11: ; preds = %cond_next7
80 cond_next13: ; preds = %cond_true11, %cond_next7
81 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
82 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
83 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
85 cond_true17: ; preds = %cond_next13
86 call void @foo( i32 %X )
89 UnifiedReturnBlock: ; preds = %cond_next13
93 define internal fastcc void @bar2(i32 %X) {
95 call void @foo( i32 %X )
99 declare void @ext(i32*)
101 define void @test(i32 %X) {
105 tail call fastcc void @bar( i32 %X )
106 tail call fastcc void @bar( i32 %X )
107 tail call fastcc void @bar2( i32 %X )
108 tail call fastcc void @bar2( i32 %X )