Improve switch code emission for a balanced tree (PR tree-optimization/86847).
authorMartin Liska <mliska@suse.cz>
Mon, 27 Aug 2018 12:21:11 +0000 (14:21 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 27 Aug 2018 12:21:11 +0000 (12:21 +0000)
commitbb79aba479cf228832b8d2c6bfb8bf420a1f6f4a
treed61a4d8814d2d3bcab0e31877144218695fa88ad
parent377afcd5beb350a1b7cd07b0a868a766345073e0
Improve switch code emission for a balanced tree (PR tree-optimization/86847).

2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86847
* tree-switch-conversion.c (switch_decision_tree::dump_case_nodes):
        Dump also subtree probability.
(switch_decision_tree::do_jump_if_equal): New function.
(switch_decision_tree::emit_case_nodes): Handle special
        situations in balanced tree that can be emitted much simpler.
        Fix calculation of probabilities that happen in tree expansion.
* tree-switch-conversion.h (struct cluster): Add
        is_single_value_p.
(struct simple_cluster): Likewise.
(struct case_tree_node): Add new function has_child.
(do_jump_if_equal): New.
2018-08-27  Martin Liska  <mliska@suse.cz>

        PR tree-optimization/86847
* gcc.dg/tree-ssa/switch-3.c: New test.
* gcc.dg/tree-ssa/vrp105.c: Remove.

From-SVN: r263879
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/switch-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/vrp105.c [deleted file]
gcc/tree-switch-conversion.c
gcc/tree-switch-conversion.h