[llvm-branch-commits] [llvm] 266c82f - [InstSimplify] add test for vector select with operand replacement; NFC
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 6 17:24:27 PDT 2021
Author: Sanjay Patel
Date: 2021-05-06T17:21:49-07:00
New Revision: 266c82f94da232d736f413c8d9e08d066c2d7202
URL: https://github.com/llvm/llvm-project/commit/266c82f94da232d736f413c8d9e08d066c2d7202
DIFF: https://github.com/llvm/llvm-project/commit/266c82f94da232d736f413c8d9e08d066c2d7202.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.
(cherry picked from commit 78e5cf66fec52c8e6e665c3c9e64d38498d94a5d)
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 6460b42d63c1e..68e7411c8310f 100644
--- a/llvm/test/Transforms/InstSimplify/select.ll
+++ b/llvm/test/Transforms/InstSimplify/select.ll
@@ -969,6 +969,28 @@ define <vscale x 2 x i1> @ignore_scalable_undef(<vscale x 2 x i1> %cond) {
ret <vscale x 2 x i1> %s
}
+define i32 @select_ctpop_zero(i32 %x) {
+; CHECK-LABEL: @select_ctpop_zero(
+; 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-branch-commits
mailing list