Skip to content

Commit c7902d8

Browse files
committed
[InstCombine] Add test for isKnownNonZero() undef miscompile (NFC)
1 parent f811d7b commit c7902d8

File tree

1 file changed

+26
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+26
-0
lines changed

llvm/test/Transforms/InstCombine/add.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,6 +3093,32 @@ define <2 x i32> @dec_zext_add_nonzero_vec(<2 x i8> %x) {
30933093
ret <2 x i32> %c
30943094
}
30953095

3096+
define <2 x i32> @dec_zext_add_nonzero_vec_undef0(<2 x i8> %x) {
3097+
; CHECK-LABEL: @dec_zext_add_nonzero_vec_undef0(
3098+
; CHECK-NEXT: [[O:%.*]] = or <2 x i8> [[X:%.*]], <i8 8, i8 undef>
3099+
; CHECK-NEXT: [[C:%.*]] = zext <2 x i8> [[O]] to <2 x i32>
3100+
; CHECK-NEXT: ret <2 x i32> [[C]]
3101+
;
3102+
%o = or <2 x i8> %x, <i8 8, i8 undef>
3103+
%a = add <2 x i8> %o, <i8 -1, i8 -1>
3104+
%b = zext <2 x i8> %a to <2 x i32>
3105+
%c = add <2 x i32> %b, <i32 1, i32 1>
3106+
ret <2 x i32> %c
3107+
}
3108+
3109+
define <2 x i32> @dec_zext_add_nonzero_poison0(<2 x i8> %x) {
3110+
; CHECK-LABEL: @dec_zext_add_nonzero_poison0(
3111+
; CHECK-NEXT: [[O:%.*]] = or <2 x i8> [[X:%.*]], <i8 8, i8 poison>
3112+
; CHECK-NEXT: [[C:%.*]] = zext <2 x i8> [[O]] to <2 x i32>
3113+
; CHECK-NEXT: ret <2 x i32> [[C]]
3114+
;
3115+
%o = or <2 x i8> %x, <i8 8, i8 poison>
3116+
%a = add <2 x i8> %o, <i8 -1, i8 -1>
3117+
%b = zext <2 x i8> %a to <2 x i32>
3118+
%c = add <2 x i32> %b, <i32 1, i32 1>
3119+
ret <2 x i32> %c
3120+
}
3121+
30963122
define <2 x i32> @dec_zext_add_nonzero_vec_poison1(<2 x i8> %x) {
30973123
; CHECK-LABEL: @dec_zext_add_nonzero_vec_poison1(
30983124
; CHECK-NEXT: [[O:%.*]] = or <2 x i8> [[X:%.*]], <i8 8, i8 8>

0 commit comments

Comments
 (0)