[DAG] Teach how to turn a build_vector into a shuffle if some of the operands are...
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 21 Nov 2014 14:32:06 +0000 (14:32 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Fri, 21 Nov 2014 14:32:06 +0000 (14:32 +0000)
commit0225b5bf6f7d8603191863530c40592502496a04
tree8a11628eddc5223c09d9b39a6fdabd91f376c135
parent7a0f81a9b721d14b5c9840ea7d104ed8bf5f870b
[DAG] Teach how to turn a build_vector into a shuffle if some of the operands are zero.

Before this patch, the DAGCombiner only tried to convert build_vector dag nodes
into shuffles if all operands were either extract_vector_elt or undef.

This patch improves that logic and teaches the DAGCombiner how to deal with
build_vector dag nodes where one or more operands are zero. A build_vector
dag node with some zero operands is turned into a shuffle only if the resulting
shuffle mask is legal for the target.

llvm-svn: 222536
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/sse41.ll