From 3883fcd0c0e439ef435f35f7816ee1360b9ca570 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 1 Jun 2018 18:52:38 +0000 Subject: [PATCH] [InstCombine] add tests for broken shuffle transform (PR37648) llvm-svn: 333779 --- .../Transforms/InstCombine/vec_shuffle.ll | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index 6824c3c1266e..5447063bbf6e 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vec_shuffle.ll @@ -582,3 +582,26 @@ define <2 x i32*> @pr23113(<4 x i32*> %A) { %1 = shufflevector <4 x i32*> %A, <4 x i32*> undef, <2 x i32> ret <2 x i32*> %1 } + +; FIXME: Unused lanes in the new binop should not kill the entire op. + +define <2 x i32> @PR37648(<2 x i32> %x) { +; CHECK-LABEL: @PR37648( +; CHECK-NEXT: ret <2 x i32> undef +; + %splat = shufflevector <2 x i32> %x, <2 x i32> undef, <2 x i32> zeroinitializer + %r = urem <2 x i32> %splat, + ret <2 x i32> %r +} + +define <2 x float> @splat_first_fp(<2 x float> %x) { +; CHECK-LABEL: @splat_first_fp( +; CHECK-NEXT: [[TMP1:%.*]] = fadd <2 x float> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> undef, <2 x i32> zeroinitializer +; CHECK-NEXT: ret <2 x float> [[TMP2]] +; + %splat = shufflevector <2 x float> %x, <2 x float> undef, <2 x i32> zeroinitializer + %r = fadd <2 x float> %splat, + ret <2 x float> %r +} +