[InstCombine][test] add tests for icmp simplify miscompile (PR50944); NFC

This commit is contained in:
Sanjay Patel 2021-07-01 13:36:46 -04:00
parent e4b9fecd39
commit 09e3bf01b3
1 changed files with 20 additions and 0 deletions

View File

@ -3930,3 +3930,23 @@ bb:
%i3 = icmp eq i32 %i, %i2
ret i1 %i3
}
; PR50944
define i1 @thread_cmp_over_select_with_poison_trueval(i1 %b) {
; CHECK-LABEL: @thread_cmp_over_select_with_poison_trueval(
; CHECK-NEXT: ret i1 poison
;
%s = select i1 %b, i32 poison, i32 0
%tobool = icmp ne i32 %s, 0
ret i1 %tobool
}
define i1 @thread_cmp_over_select_with_poison_falseval(i1 %b) {
; CHECK-LABEL: @thread_cmp_over_select_with_poison_falseval(
; CHECK-NEXT: ret i1 poison
;
%s = select i1 %b, i32 1, i32 poison
%tobool = icmp ne i32 %s, 0
ret i1 %tobool
}