Skip to content

Commit 39c7b9e

Browse files
committed
[SCCP] Update tests. NFC.
1 parent b2fd3c7 commit 39c7b9e

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

llvm/test/Transforms/SCCP/conditions-ranges-with-undef.ll

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ false:
3636

3737
declare void @use.i32(i32)
3838

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.
4139
define void @val_undef_range() {
4240
; CHECK-LABEL: @val_undef_range(
4341
; CHECK-NEXT: entry:
@@ -111,9 +109,6 @@ false:
111109
ret void
112110
}
113111

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.
117112
define void @val_undef_to_cr_to_overdef_range(i32 %a, i1 %cond) {
118113
; CHECK-LABEL: @val_undef_to_cr_to_overdef_range(
119114
; CHECK-NEXT: entry:
@@ -161,6 +156,43 @@ false:
161156
ret void
162157
}
163158

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+
164196
; All uses of %p can be replaced by a constant (10), we are allowed to use it
165197
; as a bound too.
166198
define void @bound_singlecrfromundef(i32 %a, i1 %cond) {

0 commit comments

Comments
 (0)