From: Sanjay Patel Date: Mon, 5 Apr 2021 20:11:39 +0000 (-0400) Subject: [InstSimplify] add test for vector select with operand replacement; NFC X-Git-Tag: llvmorg-14-init~10424 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78e5cf66fec52c8e6e665c3c9e64d38498d94a5d;p=platform%2Fupstream%2Fllvm.git [InstSimplify] add test for vector select with operand replacement; NFC We need a sibling fix to c590a9880d7a ( https://llvm.org/PR49832 ) to avoid miscompiling. --- diff --git a/llvm/test/Transforms/InstSimplify/select.ll b/llvm/test/Transforms/InstSimplify/select.ll index f106b90..00cb5c1 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> + %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) {