From: Sanjay Patel Date: Tue, 5 Feb 2019 22:46:13 +0000 (+0000) Subject: [InstCombine] split shuffle test to show extra use constraint; NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=028b57c02dfd2d183ad16a433910e50c078ae58d;p=llvm [InstCombine] split shuffle test to show extra use constraint; NFC As discussed in D53037, this transform can cause codegen problems if the 1st shuffle has multiple uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353233 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index b82c8117eeb..401bcee4991 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -182,10 +182,21 @@ define <2 x i8> @extract_subvector_of_shuffle(<2 x i8> %x, <2 x i8> %y) { ret <2 x i8> %extract_subv } -; Extra uses are ok. ; Undef elements in either mask are ok. Undefs from the 2nd shuffle mask should propagate to the new shuffle. ; The type of the inputs does not have to match the output type. +define <4 x i8> @extract_subvector_of_shuffle_undefs_types(<2 x i8> %x, <2 x i8> %y) { +; CHECK-LABEL: @extract_subvector_of_shuffle_undefs_types( +; CHECK-NEXT: [[EXTRACT_SUBV:%.*]] = shufflevector <2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]], <4 x i32> +; CHECK-NEXT: ret <4 x i8> [[EXTRACT_SUBV]] +; + %shuf = shufflevector <2 x i8> %x, <2 x i8> %y, <5 x i32> + %extract_subv = shufflevector <5 x i8> %shuf, <5 x i8> undef, <4 x i32> + ret <4 x i8> %extract_subv +} + +; FIXME: Extra uses are not ok - we should only do the transform when we can eliminate an instruction. + declare void @use_v5i8(<5 x i8>) define <4 x i8> @extract_subvector_of_shuffle_extra_use(<2 x i8> %x, <2 x i8> %y) { @@ -723,8 +734,8 @@ define <8 x i8> @pr19730(<16 x i8> %in0) { define i32 @pr19737(<4 x i32> %in0) { ; CHECK-LABEL: @pr19737( -; CHECK-NEXT: [[RV_RHS:%.*]] = extractelement <4 x i32> [[IN0:%.*]], i32 0 -; CHECK-NEXT: ret i32 [[RV_RHS]] +; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x i32> [[IN0:%.*]], i32 0 +; CHECK-NEXT: ret i32 [[TMP1]] ; %shuffle.i = shufflevector <4 x i32> zeroinitializer, <4 x i32> %in0, <4 x i32> %neg.i = xor <4 x i32> %shuffle.i,