summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2013-05-01 00:25:27 +0000
committerJim Grosbach <grosbach@apple.com>2013-05-01 00:25:27 +0000
commitd11584a7f7cbd4402d870af1fd6e2f38f55e4898 (patch)
treeb2436181eac2e82b712b0341f0f04ee3e1cf61fb /llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
parentbcf2bdc922d64778694dfd51fc125dc2396d7996 (diff)
downloadbcm5719-llvm-d11584a7f7cbd4402d870af1fd6e2f38f55e4898.tar.gz
bcm5719-llvm-d11584a7f7cbd4402d870af1fd6e2f38f55e4898.zip
Revert "InstCombine: Fold more shuffles of shuffles."
This reverts commit r180802 There's ongoing discussion about whether this is the right place to make this transformation. Reverting for now while we figure it out. llvm-svn: 180834
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index 56243059a61..de8a3acdbd8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -614,16 +614,11 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
// we are absolutely afraid of producing a shuffle mask not in the input
// program, because the code gen may not be smart enough to turn a merged
// shuffle into two specific shuffles: it may produce worse code. As such,
- // we only merge two shuffles if the result is a splat, one of the input
- // input shuffle masks, or if there's only one input to the shuffle.
- // In this case, merging the shuffles just removes one instruction, which
- // we know is safe. This is good for things like
+ // we only merge two shuffles if the result is either a splat or one of the
+ // input shuffle masks. In this case, merging the shuffles just removes
+ // one instruction, which we know is safe. This is good for things like
// turning: (splat(splat)) -> splat, or
// merge(V[0..n], V[n+1..2n]) -> V[0..2n]
- //
- // FIXME: This is almost certainly far, far too conservative. We should
- // have a better model. Perhaps a TargetTransformInfo hook to ask whether
- // a shuffle is considered OK?
ShuffleVectorInst* LHSShuffle = dyn_cast<ShuffleVectorInst>(LHS);
ShuffleVectorInst* RHSShuffle = dyn_cast<ShuffleVectorInst>(RHS);
if (LHSShuffle)
@@ -748,10 +743,8 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
}
// If the result mask is equal to one of the original shuffle masks,
- // or is a splat, do the replacement. Similarly, if there is only one
- // input vector, go ahead and do the folding.
- if (isSplat || newMask == LHSMask || newMask == RHSMask || newMask == Mask ||
- isa<UndefValue>(RHS)) {
+ // or is a splat, do the replacement.
+ if (isSplat || newMask == LHSMask || newMask == RHSMask || newMask == Mask) {
SmallVector<Constant*, 16> Elts;
Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
for (unsigned i = 0, e = newMask.size(); i != e; ++i) {
OpenPOWER on IntegriCloud