[DAGCombiner] Improve the shuffle-vector folding logic.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 21 Jul 2014 07:30:54 +0000 (07:30 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Mon, 21 Jul 2014 07:30:54 +0000 (07:30 +0000)
commit19e39c6f12329eb5f23c127c6b1495376a01ad5a
treeb71ccc0b5b9d651ce0c605f892a588fc822446e0
parent3d1975d44b9d3e56aea5a73f495d7fbbd56c663f
[DAGCombiner] Improve the shuffle-vector folding logic.

Canonicalize shuffles according to rules:
 *  shuffle(A, shuffle(A, B)) -> shuffle(shuffle(A,B), A)
 *  shuffle(B, shuffle(A, B)) -> shuffle(shuffle(A,B), B)
 *  shuffle(B, shuffle(A, Undef)) -> shuffle(shuffle(A, Undef), B)

This patch helps identifying more shuffle pairs that could be combined reusing
the already existing rules in the DAGCombiner.

Added new test 'combine-vec-shuffle-5.ll' to verify that the canonicalized
shuffles are now folded into a single shuffle node by the DAGCombiner.
Added more test cases to 'combine-vec-shuffle-4.ll'.

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