diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-04-27 11:41:06 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-04-27 11:41:06 +0000 |
commit | 55e03c1992776334e04330e1afc1a652e92f88dc (patch) | |
tree | c8152d34194c143015679ebaee27a5bbccc381c5 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | f090afddb461c3e2ac4855e27908be87568db9dd (diff) | |
download | llvm-55e03c1992776334e04330e1afc1a652e92f88dc.tar.gz llvm-55e03c1992776334e04330e1afc1a652e92f88dc.tar.bz2 llvm-55e03c1992776334e04330e1afc1a652e92f88dc.tar.xz |
SelectionDAG: Aggressively fold shuffles of constant splats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3f68d49da6..46d0fcac41 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1441,6 +1441,11 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, SDLoc dl, SDValue N1, if (Identity && NElts) return N1; + // Shuffling a constant splat doesn't change the result. + if (N2Undef && N1.getOpcode() == ISD::BUILD_VECTOR) + if (cast<BuildVectorSDNode>(N1)->getConstantSplatValue()) + return N1; + FoldingSetNodeID ID; SDValue Ops[2] = { N1, N2 }; AddNodeIDNode(ID, ISD::VECTOR_SHUFFLE, getVTList(VT), Ops, 2); |