[SDAG] When performing post-legalize DAG combining, run the legalizer
authorChandler Carruth <chandlerc@gmail.com>
Sat, 26 Jul 2014 05:49:40 +0000 (05:49 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 26 Jul 2014 05:49:40 +0000 (05:49 +0000)
commit69359ed45b57ad4b2add357d2a11fbb91c0fde08
treed214a2782428998dd8cf9ce68be2cba87daecb9d
parentc94ff3dc78017b1fd401beb311ae9d55e4a870a8
[SDAG] When performing post-legalize DAG combining, run the legalizer
over each node in the worklist prior to combining.

This allows the combiner to produce new nodes which need to go back
through legalization. This is particularly useful when generating
operands to target specific nodes in a post-legalize DAG combine where
the operands are significantly easier to express as pre-legalized
operations. My immediate use case will be PSHUFB formation where we need
to build a constant shuffle mask with a build_vector node.

This also refactors the relevant functionality in the legalizer to
support this, and updates relevant tests. I've spoken to the R600 folks
and these changes look like improvements to them. The avx512 change
needs to be investigated, I suspect there is a disagreement between the
legalizer and the DAG combiner there, but it seems a minor issue so
leaving it to be re-evaluated after this patch.

Differential Revision: http://reviews.llvm.org/D4564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214020 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
test/CodeGen/R600/fp_to_sint.ll
test/CodeGen/R600/fp_to_uint.ll
test/CodeGen/R600/setcc-equivalent.ll
test/CodeGen/X86/avx512-cmp.ll