diff options
author | Zvi Rackover <zvi.rackover@intel.com> | 2017-03-30 01:42:57 +0000 |
---|---|---|
committer | Zvi Rackover <zvi.rackover@intel.com> | 2017-03-30 01:42:57 +0000 |
commit | 7569436f8119931dc817b018bd8380ef7e56c056 (patch) | |
tree | 110e8b98e71f541282281fd5ff15a89de7362d6a /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | d7d1d517ee13d8fad6279de29f236295bef10b58 (diff) | |
download | bcm5719-llvm-7569436f8119931dc817b018bd8380ef7e56c056.tar.gz bcm5719-llvm-7569436f8119931dc817b018bd8380ef7e56c056.zip |
[DAGCombine] A shuffle of a splat is always the splat itself
Summary:
Add a simplification:
shuffle (splat-shuffle), undef, M --> splat-shuffle
Fixes pr32449
Patch by Sanjay Patel
Reviewers: eli.friedman, RKSimon, spatel
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D31426
llvm-svn: 299047
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 922947a6e70..ce485a9e40f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -14643,6 +14643,12 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) { return DAG.getVectorShuffle(VT, SDLoc(N), N0, N1, NewMask); } + // A shuffle of a splat is always the splat itself: + // shuffle (splat-shuffle), undef, M --> splat-shuffle + if (auto *N0Shuf = dyn_cast<ShuffleVectorSDNode>(N0)) + if (N1.isUndef() && N0Shuf->isSplat()) + return N0; + // If it is a splat, check if the argument vector is another splat or a // build_vector. if (SVN->isSplat() && SVN->getSplatIndex() < (int)NumElts) { |