diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2014-05-13 06:07:21 +0000 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2014-05-13 06:07:21 +0000 |
commit | b575ee8294e9a6472cb7fb05339d40996247053e (patch) | |
tree | 578593b4d032f181c4d83c48d1a3fe9a479aa415 /llvm | |
parent | e897d7e7c2fe6ac21650de063101c65b28ca1149 (diff) | |
download | bcm5719-llvm-b575ee8294e9a6472cb7fb05339d40996247053e.tar.gz bcm5719-llvm-b575ee8294e9a6472cb7fb05339d40996247053e.zip |
Fix type of shuffle resulted from shuffle merge.
This fix resolves PR19730.
llvm-svn: 208666
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp | 10 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/vec_shuffle.ll | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index bd647d9e1cd..8c5e202b5c5 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/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/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index a3f7f79624d..2e6f787f833 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/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> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> + %shuffle1 = shufflevector <8 x i8> %shuffle, <8 x i8> undef, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0> + ret <8 x i8> %shuffle1 +} |