|
36 | 36 |
|
37 | 37 | declare void @use.i32(i32) |
38 | 38 |
|
39 | | -; It is not allowed to use the range information from the condition to remove |
40 | | -; %a.127 = and ... in the true block, as %a could be undef. |
41 | 39 | define void @val_undef_range() { |
42 | 40 | ; CHECK-LABEL: @val_undef_range( |
43 | 41 | ; CHECK-NEXT: entry: |
@@ -111,9 +109,6 @@ false: |
111 | 109 | ret void |
112 | 110 | } |
113 | 111 |
|
114 | | - |
115 | | -; It is not allowed to use the information from the condition ([0, 128)) |
116 | | -; to remove a.127.2 = and i32 %p, 127, as %p might be undef. |
117 | 112 | define void @val_undef_to_cr_to_overdef_range(i32 %a, i1 %cond) { |
118 | 113 | ; CHECK-LABEL: @val_undef_to_cr_to_overdef_range( |
119 | 114 | ; CHECK-NEXT: entry: |
@@ -161,6 +156,43 @@ false: |
161 | 156 | ret void |
162 | 157 | } |
163 | 158 |
|
| 159 | +; It is not allowed to use the range information from the condition to remove |
| 160 | +; %p.127 = and i32 %p, 127, as %p could be undef. |
| 161 | +define void @masked_incoming_val_with_undef(i32 %a, i1 %cond) { |
| 162 | +; CHECK-LABEL: @masked_incoming_val_with_undef( |
| 163 | +; CHECK-NEXT: entry: |
| 164 | +; CHECK-NEXT: [[A_127:%.*]] = and i32 [[A:%.*]], 127 |
| 165 | +; CHECK-NEXT: br i1 [[COND:%.*]], label [[INC1:%.*]], label [[INC2:%.*]] |
| 166 | +; CHECK: inc1: |
| 167 | +; CHECK-NEXT: br label [[IF:%.*]] |
| 168 | +; CHECK: inc2: |
| 169 | +; CHECK-NEXT: br label [[IF]] |
| 170 | +; CHECK: if: |
| 171 | +; CHECK-NEXT: [[P:%.*]] = phi i32 [ [[A_127]], [[INC1]] ], [ undef, [[INC2]] ] |
| 172 | +; CHECK-NEXT: [[P_127:%.*]] = and i32 [[P]], 127 |
| 173 | +; CHECK-NEXT: call void @use.i32(i32 [[P_127]]) |
| 174 | +; CHECK-NEXT: ret void |
| 175 | +; |
| 176 | +entry: |
| 177 | + %a.127 = and i32 %a, 127 |
| 178 | + br i1 %cond, label %inc1, label %inc2 |
| 179 | + |
| 180 | +inc1: |
| 181 | + br label %if |
| 182 | + |
| 183 | +inc2: |
| 184 | + br label %if |
| 185 | + |
| 186 | +if: |
| 187 | + %p = phi i32 [ %a.127, %inc1 ], [ undef, %inc2 ] |
| 188 | + %p.127 = and i32 %p, 127 |
| 189 | + call void @use.i32(i32 %p.127) |
| 190 | + ret void |
| 191 | + |
| 192 | +false: |
| 193 | + ret void |
| 194 | +} |
| 195 | + |
164 | 196 | ; All uses of %p can be replaced by a constant (10), we are allowed to use it |
165 | 197 | ; as a bound too. |
166 | 198 | define void @bound_singlecrfromundef(i32 %a, i1 %cond) { |
|
0 commit comments