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 | 6bca8ef6670f3a524c30d68eb7962f4a1dd1b099 (patch) | |
tree | 61c7219c77e513ad05c21e2c890048bf1902b742 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 66935020c4241bb8cb0478cd6bbaf0a9f90d02f7 (diff) | |
download | bcm5719-llvm-6bca8ef6670f3a524c30d68eb7962f4a1dd1b099.tar.gz bcm5719-llvm-6bca8ef6670f3a524c30d68eb7962f4a1dd1b099.zip |
SelectionDAG: Aggressively fold shuffles of constant splats.
llvm-svn: 207352
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3f68d49da68..46d0fcac410 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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); |