[x86, dag] Teach the DAG combiner to prune inputs toa vector_shuffle
authorChandler Carruth <chandlerc@gmail.com>
Sun, 5 Oct 2014 19:14:34 +0000 (19:14 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 5 Oct 2014 19:14:34 +0000 (19:14 +0000)
commit560bddce204e2502095821b6fde446cff7bc4840
treecf0883404a6237fd96f0bab5fce531b6d68fa1c9
parent446817b4ef197188c213a1f60f37446ee9c57862
[x86, dag] Teach the DAG combiner to prune inputs toa vector_shuffle
that are unused.

This allows the combiner to delete math feeding shuffles where the math
isn't actually necessary. This improves some of the vperm2x128 tests
that regressed when the vector shuffle lowering started actually
generating vperm instructions rather than forcibly decomposing them.

Sadly, this isn't enough to get this *really* right because we still
form a completely unnecessary permutation. To fix that, we also need to
fold shuffles which just rearrange concatenated or inserted subvectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219086 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/avx-vperm2x128.ll
test/CodeGen/X86/vector-shuffle-combining.ll