[llvm] 78e5cf6 - [InstSimplify] add test for vector select with operand replacement; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 5 13:58:41 PDT 2021
Author: Sanjay Patel
Date: 2021-04-05T16:52:34-04:00
New Revision: 78e5cf66fec52c8e6e665c3c9e64d38498d94a5d
URL: https://github.com/llvm/llvm-project/commit/78e5cf66fec52c8e6e665c3c9e64d38498d94a5d
DIFF: https://github.com/llvm/llvm-project/commit/78e5cf66fec52c8e6e665c3c9e64d38498d94a5d.diff
LOG: [InstSimplify] add test for vector select with operand replacement; NFC
We need a sibling fix to c590a9880d7a
( https://llvm.org/PR49832 ) to avoid miscompiling.
Added:
Modified:
llvm/test/Transforms/InstSimplify/select.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/select.ll b/llvm/test/Transforms/InstSimplify/select.ll
index f106b909a8ac..00cb5c1d5ef3 100644
--- a/llvm/test/Transforms/InstSimplify/select.ll
+++ b/llvm/test/Transforms/InstSimplify/select.ll
@@ -1017,18 +1017,26 @@ define i32 @select_neutral_sub_lhs(i32 %x, i32 %y) {
define i32 @select_ctpop_zero(i32 %x) {
; CHECK-LABEL: @select_ctpop_zero(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: [[TMP0:%.*]] = call i32 @llvm.ctpop.i32(i32 [[X:%.*]])
-; CHECK-NEXT: ret i32 [[TMP0]]
-;
-entry:
- %0 = icmp eq i32 %x, 0
- %1 = call i32 @llvm.ctpop.i32(i32 %x)
- %sel = select i1 %0, i32 0, i32 %1
+; CHECK-NEXT: [[T1:%.*]] = call i32 @llvm.ctpop.i32(i32 [[X:%.*]])
+; CHECK-NEXT: ret i32 [[T1]]
+;
+ %t0 = icmp eq i32 %x, 0
+ %t1 = call i32 @llvm.ctpop.i32(i32 %x)
+ %sel = select i1 %t0, i32 0, i32 %t1
ret i32 %sel
}
declare i32 @llvm.ctpop.i32(i32)
+define <2 x i32> @vec_select_no_equivalence(<2 x i32> %x, <2 x i32> %y) {
+; CHECK-LABEL: @vec_select_no_equivalence(
+; CHECK-NEXT: ret <2 x i32> zeroinitializer
+;
+ %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> zeroinitializer
+ ret <2 x i32> %s
+}
+
; TODO: these can be optimized more
define i32 @poison(i32 %x, i32 %y) {
More information about the llvm-commits
mailing list