[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)
commit0fb2013192e23a8f5a46c752a21fd9282737e4af
tree4875caf9ec77ff6fee68d22138e04cd74ac2d5ae
parent4d8bd41600e4a6ddc9a6d644828c370b0656c0dd
[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'.

llvm-svn: 213504
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/combine-vec-shuffle-4.ll
llvm/test/CodeGen/X86/combine-vec-shuffle-5.ll [new file with mode: 0644]