[llvm] r208666 - Fix type of shuffle resulted from shuffle merge.
Serge Pavlov
sepavloff at gmail.com
Mon May 12 23:07:21 PDT 2014
Author: sepavloff
Date: Tue May 13 01:07:21 2014
New Revision: 208666
URL: http://llvm.org/viewvc/llvm-project?rev=208666&view=rev
Log:
Fix type of shuffle resulted from shuffle merge.
This fix resolves PR19730.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp?rev=208666&r1=208665&r2=208666&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp Tue May 13 01:07:21 2014
@@ -1114,12 +1114,10 @@ Instruction *InstCombiner::visitShuffleV
// 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;
}
Modified: llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll?rev=208666&r1=208665&r2=208666&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll Tue May 13 01:07:21 2014
@@ -386,3 +386,11 @@ define <4 x i16> @pr19717a(<8 x i16> %in
%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
+}
More information about the llvm-commits
mailing list