blob: 9146576ef6160dc20a05480e20d6b611a7ea9d65 [file] [log] [blame]
Tanya Lattner97b38e12008-03-19 05:39:35 +00001; RUN: llvm-as < %s | \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis > %t
3; RUN: grep -v declare %t | not grep fail
Dan Gohman552fb262007-08-15 13:49:33 +00004; RUN: grep -v declare %t | grep pass | count 3
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005
Tanya Lattner97b38e12008-03-19 05:39:35 +00006define i32 @test1(i32 %x, i32 %y) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007entry:
Tanya Lattner97b38e12008-03-19 05:39:35 +00008 %tmp2 = or i32 %x, %y ; <i32> [#uses=1]
9 %tmp = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
10 br i1 %tmp, label %cond_true, label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011cond_true: ; preds = %entry
Tanya Lattner97b38e12008-03-19 05:39:35 +000012 %tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
13 br i1 %tmp4, label %cond_true5, label %cond_false
Dan Gohmanf17a25c2007-07-18 16:29:46 +000014cond_true5: ; preds = %cond_true
Tanya Lattner97b38e12008-03-19 05:39:35 +000015 %tmp6 = call i32 @pass( ) ; <i32> [#uses=1]
16 ret i32 %tmp6
17cond_false: ; preds = %cond_true
18 %tmp8 = call i32 @fail( ) ; <i32> [#uses=1]
19 ret i32 %tmp8
20return: ; preds = %entry
21 ret i32 0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022}
23
Tanya Lattner97b38e12008-03-19 05:39:35 +000024define i32 @test2(i32 %x, i32 %y) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000025entry:
Tanya Lattner97b38e12008-03-19 05:39:35 +000026 %tmp2 = or i32 %x, %y ; <i32> [#uses=1]
27 %tmp = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
28 br i1 %tmp, label %cond_true, label %return
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029cond_true: ; preds = %entry
Tanya Lattner97b38e12008-03-19 05:39:35 +000030 %tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
31 br i1 %tmp4, label %cond_true5, label %cond_false
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032cond_true5: ; preds = %cond_true
Tanya Lattner97b38e12008-03-19 05:39:35 +000033 %tmp6 = call i32 @pass1( ) ; <i32> [#uses=1]
34 ret i32 %tmp6
35cond_false: ; preds = %cond_true
36 %tmp8 = call i32 @pass2( ) ; <i32> [#uses=1]
37 ret i32 %tmp8
38return: ; preds = %entry
39 ret i32 0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000040}
41
Tanya Lattner97b38e12008-03-19 05:39:35 +000042declare i32 @fail()
43
44declare i32 @pass()
45
46declare i32 @pass1()
47
48declare i32 @pass2()