1 ; RUN: opt < %s -inline -S | FileCheck %s
2 ; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
3 ; Test that bar and bar2 are both inlined throughout and removed.
4 @A = weak global i32 0 ; <i32*> [#uses=1]
5 @B = weak global i32 0 ; <i32*> [#uses=1]
6 @C = weak global i32 0 ; <i32*> [#uses=1]
8 define fastcc void @foo(i32 %X) {
11 %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
12 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
13 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
14 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
16 cond_true: ; preds = %entry
20 cond_next: ; preds = %cond_true, %entry
21 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
22 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
23 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
25 cond_true5: ; preds = %cond_next
29 cond_next7: ; preds = %cond_true5, %cond_next
30 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
31 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
32 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
34 cond_true11: ; preds = %cond_next7
38 cond_next13: ; preds = %cond_true11, %cond_next7
39 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
40 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
41 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
43 cond_true17: ; preds = %cond_next13
44 call void @ext( i32* %ALL )
47 UnifiedReturnBlock: ; preds = %cond_next13
52 define internal fastcc void @bar(i32 %X) {
54 %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
55 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
56 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
57 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
59 cond_true: ; preds = %entry
63 cond_next: ; preds = %cond_true, %entry
64 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
65 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
66 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
68 cond_true5: ; preds = %cond_next
72 cond_next7: ; preds = %cond_true5, %cond_next
73 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
74 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
75 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
77 cond_true11: ; preds = %cond_next7
81 cond_next13: ; preds = %cond_true11, %cond_next7
82 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
83 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
84 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
86 cond_true17: ; preds = %cond_next13
87 call void @foo( i32 %X )
90 UnifiedReturnBlock: ; preds = %cond_next13
94 define internal fastcc void @bar2(i32 %X) {
96 call void @foo( i32 %X )
100 declare void @ext(i32*)
102 define void @test(i32 %X) {
106 tail call fastcc void @bar( i32 %X )
107 tail call fastcc void @bar( i32 %X )
108 tail call fastcc void @bar2( i32 %X )
109 tail call fastcc void @bar2( i32 %X )