1 ; Test that the inliner doesn't leave around dead allocas, and that it folds
2 ; uncond branches away after it is done specializing.
4 ; RUN: llvm-as < %s | opt -inline | llvm-dis | \
5 ; RUN: not grep {alloca.*uses=0}
6 ; RUN: llvm-as < %s | opt -inline | llvm-dis | \
7 ; RUN: not grep {br label}
8 @A = weak global i32 0 ; <i32*> [#uses=1]
9 @B = weak global i32 0 ; <i32*> [#uses=1]
10 @C = weak global i32 0 ; <i32*> [#uses=1]
12 define internal fastcc void @foo(i32 %X) {
14 %ALL = alloca i32, align 4 ; <i32*> [#uses=1]
15 %tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
16 %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
17 br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
19 cond_true: ; preds = %entry
23 cond_next: ; preds = %cond_true, %entry
24 %tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
25 %tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
26 br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
28 cond_true5: ; preds = %cond_next
32 cond_next7: ; preds = %cond_true5, %cond_next
33 %tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
34 %tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
35 br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
37 cond_true11: ; preds = %cond_next7
41 cond_next13: ; preds = %cond_true11, %cond_next7
42 %tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
43 %tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
44 br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
46 cond_true17: ; preds = %cond_next13
47 call void @ext( i32* %ALL )
50 UnifiedReturnBlock: ; preds = %cond_next13
54 declare void @ext(i32*)
58 tail call fastcc void @foo( i32 1 )
59 tail call fastcc void @foo( i32 2 )
60 tail call fastcc void @foo( i32 3 )
61 tail call fastcc void @foo( i32 8 )