[DAGCombine] Produce better code for constant splats
authorMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 22 Jan 2015 13:07:28 +0000 (13:07 +0000)
committerMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 22 Jan 2015 13:07:28 +0000 (13:07 +0000)
commit25e34d11f3cab6a79b7fc22d5385f86523550e90
treee3f6d83d0a06865c99eafe7b661aa45451e1dd9a
parenta007905e4eb7b1c2b134ee6a936d895ba9ac575a
[DAGCombine] Produce better code for constant splats

This solves PR22276.
Splats of constants would sometimes produce redundant shuffles, sometimes ridiculously so (see the PR for details). Fold these shuffles into BUILD_VECTORs early on instead.

Differential Revision: http://reviews.llvm.org/D7093

Fixed recommit of r226811.

llvm-svn: 226816
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/X86/splat-const.ll [new file with mode: 0644]
llvm/test/CodeGen/X86/sse41.ll
llvm/test/CodeGen/X86/widen_shuffle-1.ll