1 ; RUN: llvm-as < %s | opt -cee -constprop -instcombine -dce | llvm-dis | not grep 'REMOVE'
4 %cond = seteq int %A, 40
5 br bool %cond, label %T, label %F
7 %REMOVE = add int %A, 2 ; Should become = 42
14 %cond = seteq int %A, 40
15 br bool %cond, label %T, label %F
17 %REMOVE = seteq int %A, 2 ; Should become = false
24 %cond = setlt int %A, 40
25 br bool %cond, label %T, label %F
27 %REMOVE = setgt int %A, 47 ; Should become = false
30 %REMOVE2 = setge int %A, 40 ; Should become = true
35 %cond = setlt int %A, 40
36 br bool %cond, label %T, label %F
38 %REMOVE = setgt int %A, 47 ; Should become = false
44 int %test5(int %A, int %B) {
45 %cond = setne int %A, %B
46 br bool %cond, label %F, label %T
48 %C = sub int %A, %B ; = 0
55 %REMOVE = setlt int %A, 47 ; Should become dead
56 %cond = setlt int %A, 40
57 br bool %cond, label %T, label %F
59 ret bool %REMOVE ;; == true
65 %cond = setlt int %A, 40
66 br bool %cond, label %T, label %F
68 %REMOVE = xor bool %cond, true
74 ; Test that and expressions are handled...
75 bool %test8(int %A, int %B) {
76 %cond1 = setle int %A, 7
77 %cond2 = setle int %B, 7
78 %cond = and bool %cond1, %cond2
79 br bool %cond, label %T, label %F
81 %REMOVE1 = seteq int %A, 9 ; false
82 %REMOVE2 = setge int %B, 9 ; false
83 %REMOVE = or bool %REMOVE1, %REMOVE2 ; false
89 ; Test that or expressions are handled...
90 bool %test9(int %A, int %B) {
91 %cond1 = setle int %A, 7
92 %cond2 = setle int %B, 7
93 %cond = or bool %cond1, %cond2
94 br bool %cond, label %T, label %F
98 %REMOVE1 = setge int %A, 8 ; true
99 %REMOVE2 = setge int %B, 8 ; true
100 %REMOVE = or bool %REMOVE1, %REMOVE2 ; true
104 bool %test10(int %A) {
105 %cond = setle int %A, 7
106 br bool %cond, label %T, label %F
110 %REMOVE = setge int %A, 8
114 ; Implement correlated comparisons against non-constants
115 bool %test11(int %A, int %B) {
116 %cond = setlt int %A, %B
117 br bool %cond, label %T, label %F
119 %REMOVE1 = seteq int %A, %B ; false
120 %REMOVE2 = setle int %A, %B ; true
121 %cond2 = and bool %REMOVE1, %REMOVE2
127 bool %test12(int %A) {
128 %cond = setlt int %A, 0
129 br bool %cond, label %T, label %F
131 %REMOVE = setne int %A, 0 ; true