[llvm-branch-commits] [llvm] c89d500 - [InstCombine] add test for miscompile from select value equivalence; NFC
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 6 17:24:23 PDT 2021
Author: Sanjay Patel
Date: 2021-05-06T17:19:54-07:00
New Revision: c89d50033228953d29e835ea5cb8e7066c0d8583
URL: https://github.com/llvm/llvm-project/commit/c89d50033228953d29e835ea5cb8e7066c0d8583
DIFF: https://github.com/llvm/llvm-project/commit/c89d50033228953d29e835ea5cb8e7066c0d8583.diff
LOG: [InstCombine] add test for miscompile from select value equivalence; NFC
The new test is reduced from:
https://llvm.org/PR49832
...but we already show a potential miscompile in the existing test too.
(cherry picked from commit c0b0da4684908b8e8143c0762fc766c1a2a5849f)
Added:
Modified:
llvm/test/Transforms/InstCombine/select-binop-cmp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
index bbf7456ae811..beea2862a8ef 100644
--- a/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
+++ b/llvm/test/Transforms/InstCombine/select-binop-cmp.ll
@@ -551,6 +551,8 @@ define i32 @select_xor_icmp_bad_6(i32 %x, i32 %y, i32 %z) {
ret i32 %C
}
+; FIXME: Value equivalence substitution is all-or-nothing, so needs a scalar compare.
+
define <2 x i8> @select_xor_icmp_vec_bad(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z) {
; CHECK-LABEL: @select_xor_icmp_vec_bad(
; CHECK-NEXT: [[A:%.*]] = icmp eq <2 x i8> [[X:%.*]], <i8 5, i8 3>
@@ -564,6 +566,18 @@ define <2 x i8> @select_xor_icmp_vec_bad(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z)
ret <2 x i8> %C
}
+; FIXME: Value equivalence substitution is all-or-nothing, so needs a scalar compare.
+
+define <2 x i32> @vec_select_no_equivalence(<2 x i32> %x) {
+; CHECK-LABEL: @vec_select_no_equivalence(
+; CHECK-NEXT: ret <2 x i32> [[X:%.*]]
+;
+ %x10 = shufflevector <2 x i32> %x, <2 x i32> undef, <2 x i32> <i32 1, i32 0>
+ %cond = icmp eq <2 x i32> %x, zeroinitializer
+ %s = select <2 x i1> %cond, <2 x i32> %x10, <2 x i32> %x
+ ret <2 x i32> %s
+}
+
; Folding this would only be legal if we sanitized undef to 0.
define <2 x i8> @select_xor_icmp_vec_undef(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z) {
; CHECK-LABEL: @select_xor_icmp_vec_undef(
More information about the llvm-branch-commits
mailing list