[SDAG] Introduce a combined set to the DAG combiner which tracks nodes
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jul 2014 22:15:28 +0000 (22:15 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jul 2014 22:15:28 +0000 (22:15 +0000)
commit9f4530b95dce63c7f335001d0f955e36e57df88a
tree2e9bf3762223effe70e8ab8ce6bd570105930b84
parent80b869461e7adb6504480f92447e6aef2fbe921e
[SDAG] Introduce a combined set to the DAG combiner which tracks nodes
which have successfully round-tripped through the combine phase, and use
this to ensure all operands to DAG nodes are visited by the combiner,
even if they are only added during the combine phase.

This is critical to have the combiner reach nodes that are *introduced*
during combining. Previously these would sometimes be visited and
sometimes not be visited based on whether they happened to end up on the
worklist or not. Now we always run them through the combiner.

This fixes quite a few bad codegen test cases lurking in the suite while
also being more principled. Among these, the TLS codegeneration is
particularly exciting for programs that have this in the critical path
like TSan-instrumented binaries (although I think they engineer to use
a different TLS that is faster anyways).

I've tried to check for compile-time regressions here by running llc
over a merged (but not LTO-ed) clang bitcode file and observed at most
a 3% slowdown in llc. Given that this is essentially a worst case (none
of opt or clang are running at this phase) I think this is tolerable.
The actual LTO case should be even less costly, and the cost in normal
compilation should be negligible.

With this combining logic, it is possible to re-legalize as we combine
which is necessary to implement PSHUFB formation on x86 as
a post-legalize DAG combine (my ultimate goal).

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

llvm-svn: 213898
19 files changed:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/arm64-dagcombiner-indexed-load.ll [deleted file]
llvm/test/CodeGen/ARM/aapcs-hfa-code.ll
llvm/test/CodeGen/Mips/cmov.ll
llvm/test/CodeGen/R600/add_i64.ll
llvm/test/CodeGen/R600/or.ll
llvm/test/CodeGen/X86/2010-04-23-mmx-movdq2q.ll
llvm/test/CodeGen/X86/i8-umulo.ll
llvm/test/CodeGen/X86/jump_sign.ll
llvm/test/CodeGen/X86/lower-bitcast.ll
llvm/test/CodeGen/X86/pr15267.ll
llvm/test/CodeGen/X86/store-narrow.ll
llvm/test/CodeGen/X86/trunc-ext-ld-st.ll
llvm/test/CodeGen/X86/vector-idiv.ll
llvm/test/CodeGen/X86/widen_cast-1.ll
llvm/test/CodeGen/X86/widen_conv-1.ll
llvm/test/CodeGen/X86/widen_load-2.ll
llvm/test/CodeGen/X86/x86-64-tls-1.ll
llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll