2006-09-13 21:23:43 +02:00
|
|
|
; Test that the inliner doesn't leave around dead allocas, and that it folds
|
|
|
|
; uncond branches away after it is done specializing.
|
|
|
|
|
2009-09-11 20:01:28 +02:00
|
|
|
; RUN: opt < %s -inline -S | \
|
2007-04-15 10:30:33 +02:00
|
|
|
; RUN: not grep {alloca.*uses=0}
|
2009-09-11 20:01:28 +02:00
|
|
|
; RUN: opt < %s -inline -S | \
|
2007-04-15 10:30:33 +02:00
|
|
|
; RUN: not grep {br label}
|
2008-03-01 10:15:35 +01:00
|
|
|
@A = weak global i32 0 ; <i32*> [#uses=1]
|
|
|
|
@B = weak global i32 0 ; <i32*> [#uses=1]
|
|
|
|
@C = weak global i32 0 ; <i32*> [#uses=1]
|
2006-09-13 21:23:43 +02:00
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
define internal fastcc void @foo(i32 %X) {
|
2006-09-13 21:23:43 +02:00
|
|
|
entry:
|
2008-03-01 10:15:35 +01:00
|
|
|
%ALL = alloca i32, align 4 ; <i32*> [#uses=1]
|
|
|
|
%tmp1 = and i32 %X, 1 ; <i32> [#uses=1]
|
|
|
|
%tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
|
|
|
|
br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true
|
2006-09-13 21:23:43 +02:00
|
|
|
|
|
|
|
cond_true: ; preds = %entry
|
2008-03-01 10:15:35 +01:00
|
|
|
store i32 1, i32* @A
|
2006-09-13 21:23:43 +02:00
|
|
|
br label %cond_next
|
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
cond_next: ; preds = %cond_true, %entry
|
|
|
|
%tmp4 = and i32 %X, 2 ; <i32> [#uses=1]
|
|
|
|
%tmp4.upgrd.2 = icmp eq i32 %tmp4, 0 ; <i1> [#uses=1]
|
|
|
|
br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true5
|
2006-09-13 21:23:43 +02:00
|
|
|
|
|
|
|
cond_true5: ; preds = %cond_next
|
2008-03-01 10:15:35 +01:00
|
|
|
store i32 1, i32* @B
|
2006-09-13 21:23:43 +02:00
|
|
|
br label %cond_next7
|
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
cond_next7: ; preds = %cond_true5, %cond_next
|
|
|
|
%tmp10 = and i32 %X, 4 ; <i32> [#uses=1]
|
|
|
|
%tmp10.upgrd.3 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
|
|
|
|
br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true11
|
2006-09-13 21:23:43 +02:00
|
|
|
|
|
|
|
cond_true11: ; preds = %cond_next7
|
2008-03-01 10:15:35 +01:00
|
|
|
store i32 1, i32* @C
|
2006-09-13 21:23:43 +02:00
|
|
|
br label %cond_next13
|
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
cond_next13: ; preds = %cond_true11, %cond_next7
|
|
|
|
%tmp16 = and i32 %X, 8 ; <i32> [#uses=1]
|
|
|
|
%tmp16.upgrd.4 = icmp eq i32 %tmp16, 0 ; <i1> [#uses=1]
|
|
|
|
br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true17
|
2006-09-13 21:23:43 +02:00
|
|
|
|
|
|
|
cond_true17: ; preds = %cond_next13
|
2008-03-01 10:15:35 +01:00
|
|
|
call void @ext( i32* %ALL )
|
2006-09-13 21:23:43 +02:00
|
|
|
ret void
|
|
|
|
|
|
|
|
UnifiedReturnBlock: ; preds = %cond_next13
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
declare void @ext(i32*)
|
2006-09-13 21:23:43 +02:00
|
|
|
|
2008-03-01 10:15:35 +01:00
|
|
|
define void @test() {
|
2006-09-13 21:23:43 +02:00
|
|
|
entry:
|
2008-03-01 10:15:35 +01:00
|
|
|
tail call fastcc void @foo( i32 1 )
|
|
|
|
tail call fastcc void @foo( i32 2 )
|
|
|
|
tail call fastcc void @foo( i32 3 )
|
|
|
|
tail call fastcc void @foo( i32 8 )
|
2006-09-13 21:23:43 +02:00
|
|
|
ret void
|
|
|
|
}
|