[DAGCombiner] Add more rules to combine shuffle vector dag nodes.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 14 Jul 2014 22:46:26 +0000 (22:46 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 14 Jul 2014 22:46:26 +0000 (22:46 +0000)
commit7847229c3152026183a676782bb9fa05a598e48a
tree143dec757e31b8bfabdfdbfcb247b5bb109e2a7a
parentff985d421880a5d39077f25db9117c7301f3f79d
[DAGCombiner] Add more rules to combine shuffle vector dag nodes.

This patch teaches the DAGCombiner how to fold a pair of shuffles
according to rules:
  1.  shuffle(shuffle A, B, M0), B, M1) -> shuffle(A, B, M2)
  2.  shuffle(shuffle A, B, M0), A, M1) -> shuffle(A, B, M3)

The new rules would only trigger if the resulting shuffle has legal type and
legal mask.

Added test 'combine-vec-shuffle-3.ll' to verify that DAGCombiner correctly
folds shuffles on x86 when the resulting mask is legal. Also added some negative
cases to verify that we avoid introducing illegal shuffles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213001 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/combine-vec-shuffle-3.ll [new file with mode: 0644]