[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)
commit411fb407f8458bd51a123ee10f37cd67b04da08a
treef3b04f1485b18117e2a2cccd0163afb4b80a85db
parentd7c726c5e9556d3e4994006b65596134fcdfcb82
[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

llvm-svn: 214020
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/test/CodeGen/R600/fp_to_sint.ll
llvm/test/CodeGen/R600/fp_to_uint.ll
llvm/test/CodeGen/R600/setcc-equivalent.ll
llvm/test/CodeGen/X86/avx512-cmp.ll