Free the constants that have no uses in ~LLVMContext.
[oota-llvm.git] / test / Transforms / PredicateSimplifier / 2006-10-22-IntOr.ll
1 ; RUN: llvm-as < %s | \
2 ; RUN:   opt -predsimplify -instcombine -simplifycfg  | llvm-dis > %t
3 ; RUN: grep -v declare %t | not grep fail
4 ; RUN: grep -v declare %t | grep pass | count 3
5
6 define i32 @test1(i32 %x, i32 %y) {
7 entry:
8         %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
11 cond_true:              ; preds = %entry
12         %tmp4 = icmp eq i32 %x, 0               ; <i1> [#uses=1]
13         br i1 %tmp4, label %cond_true5, label %cond_false
14 cond_true5:             ; preds = %cond_true
15         %tmp6 = call i32 @pass( )               ; <i32> [#uses=1]
16         ret i32 %tmp6
17 cond_false:             ; preds = %cond_true
18         %tmp8 = call i32 @fail( )               ; <i32> [#uses=1]
19         ret i32 %tmp8
20 return:         ; preds = %entry
21         ret i32 0
22 }
23
24 define i32 @test2(i32 %x, i32 %y) {
25 entry:
26         %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
29 cond_true:              ; preds = %entry
30         %tmp4 = icmp eq i32 %x, 0               ; <i1> [#uses=1]
31         br i1 %tmp4, label %cond_true5, label %cond_false
32 cond_true5:             ; preds = %cond_true
33         %tmp6 = call i32 @pass1( )              ; <i32> [#uses=1]
34         ret i32 %tmp6
35 cond_false:             ; preds = %cond_true
36         %tmp8 = call i32 @pass2( )              ; <i32> [#uses=1]
37         ret i32 %tmp8
38 return:         ; preds = %entry
39         ret i32 0
40 }
41
42 declare i32 @fail()
43
44 declare i32 @pass()
45
46 declare i32 @pass1()
47
48 declare i32 @pass2()