This transformation exposed in Transforms/InstCombine/icmp-vec.ll is incorrect. The issue is that "INT_MIN <= undef" is not the same as "INT_MIN < undef". define <2 x i1> @PR27756_2(<2 x i8> %a) { %cmp = icmp sle <2 x i8> %a, { undef, 0 } ret <2 x i1> %cmp } => define <2 x i1> @PR27756_2(<2 x i8> %a) { %cmp = icmp slt <2 x i8> %a, { undef, 1 } ret <2 x i1> %cmp } Transformation doesn't verify! ERROR: Value mismatch Example: <2 x i8> %a = < #x80 (128, -128), #x80 (128, -128) > Source: <2 x i1> %cmp = < #x1 (1), #x1 (1) > Target: <2 x i1> %cmp = < #x0 (0), #x1 (1) > Source value: < #x1 (1), #x1 (1) > Target value: < #x0 (0), #x1 (1) >
This bug was probably recently introduced via an improvement for icmp canonicalization. I'll propose a fix.
https://reviews.llvm.org/D69519
Should be fixed by replacing undefs with safe constants: https://reviews.llvm.org/rGa22282be54b3
*** Bug 43731 has been marked as a duplicate of this bug. ***