From: Serge Pavlov Date: Tue, 13 May 2014 06:07:21 +0000 (+0000) Subject: Fix type of shuffle resulted from shuffle merge. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=51a167d6c4612d82a43227c293e287a9f5108591;p=oota-llvm.git Fix type of shuffle resulted from shuffle merge. This fix resolves PR19730. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208666 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index bd647d9e1cd..8c5e202b5c5 100644 --- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1114,12 +1114,10 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) { // If the result mask is an identity, replace uses of this instruction with // corresponding argument. - if (VWidth == LHSWidth) { - bool isLHSID, isRHSID; - RecognizeIdentityMask(newMask, isLHSID, isRHSID); - if (isLHSID) return ReplaceInstUsesWith(SVI, newLHS); - if (isRHSID) return ReplaceInstUsesWith(SVI, newRHS); - } + bool isLHSID, isRHSID; + RecognizeIdentityMask(newMask, isLHSID, isRHSID); + if (isLHSID && VWidth == LHSOp0Width) return ReplaceInstUsesWith(SVI, newLHS); + if (isRHSID && VWidth == RHSOp0Width) return ReplaceInstUsesWith(SVI, newRHS); return MadeChange ? &SVI : nullptr; } diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index a3f7f79624d..2e6f787f833 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -386,3 +386,11 @@ define <4 x i16> @pr19717a(<8 x i16> %in0, <8 x i16> %in1) { %mul = mul <4 x i16> %shuffle, %shuffle1 ret <4 x i16> %mul } + +define <8 x i8> @pr19730(<16 x i8> %in0) { +; CHECK-LABEL: @pr19730( +; CHECK: shufflevector + %shuffle = shufflevector <16 x i8> %in0, <16 x i8> undef, <8 x i32> + %shuffle1 = shufflevector <8 x i8> %shuffle, <8 x i8> undef, <8 x i32> + ret <8 x i8> %shuffle1 +}