Add if-chain to switch conversion pass.
authorMartin Liska <mliska@suse.cz>
Fri, 28 Aug 2020 08:26:13 +0000 (10:26 +0200)
committerMartin Liska <mliska@suse.cz>
Tue, 1 Dec 2020 10:43:25 +0000 (11:43 +0100)
commit03eb09292ef228d1d12b5168cdd748583b1f992a
tree8e41919c16c723251463ac59666965cbd82e0f6e
parent58f71a34c68711c4432b45086bfcccb78be7ace5
Add if-chain to switch conversion pass.

gcc/ChangeLog:

PR tree-optimization/14799
PR ipa/88702
* Makefile.in: Add gimple-if-to-switch.o.
* dbgcnt.def (DEBUG_COUNTER): Add new debug counter.
* passes.def: Include new pass_if_to_switch pass.
* timevar.def (TV_TREE_IF_TO_SWITCH): New timevar.
* tree-pass.h (make_pass_if_to_switch): New.
* tree-ssa-reassoc.c (struct operand_entry): Move to the header.
(dump_range_entry): Move to header file.
(debug_range_entry): Likewise.
(no_side_effect_bb): Make it global.
* tree-switch-conversion.h (simple_cluster::simple_cluster):
Add inline for couple of functions in order to prevent error
about multiple defined symbols.
* gimple-if-to-switch.cc: New file.
* tree-ssa-reassoc.h: New file.

gcc/testsuite/ChangeLog:

PR tree-optimization/14799
PR ipa/88702
* gcc.dg/tree-ssa/pr96480.c: Disable if-to-switch conversion.
* gcc.dg/tree-ssa/reassoc-32.c: Likewise.
* g++.dg/tree-ssa/if-to-switch-1.C: New test.
* gcc.dg/tree-ssa/if-to-switch-1.c: New test.
* gcc.dg/tree-ssa/if-to-switch-2.c: New test.
* gcc.dg/tree-ssa/if-to-switch-3.c: New test.
* gcc.dg/tree-ssa/if-to-switch-4.c: New test.
* gcc.dg/tree-ssa/if-to-switch-5.c: New test.
* gcc.dg/tree-ssa/if-to-switch-6.c: New test.
* gcc.dg/tree-ssa/if-to-switch-7.c: New test.
* gcc.dg/tree-ssa/if-to-switch-8.c: New test.
20 files changed:
gcc/Makefile.in
gcc/dbgcnt.def
gcc/gimple-if-to-switch.cc [new file with mode: 0644]
gcc/passes.def
gcc/testsuite/g++.dg/tree-ssa/if-to-switch-1.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr96480.c
gcc/testsuite/gcc.dg/tree-ssa/reassoc-32.c
gcc/timevar.def
gcc/tree-pass.h
gcc/tree-ssa-reassoc.c
gcc/tree-ssa-reassoc.h [new file with mode: 0644]
gcc/tree-switch-conversion.h