https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86847
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> --- Author: marxin Date: Mon Aug 27 12:21:11 2018 New Revision: 263879 URL: https://gcc.gnu.org/viewcvs?rev=263879&root=gcc&view=rev Log: Improve switch code emission for a balanced tree (PR tree-optimization/86847). 2018-08-27 Martin Liska <mli...@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 <mli...@suse.cz> PR tree-optimization/86847 * gcc.dg/tree-ssa/switch-3.c: New test. * gcc.dg/tree-ssa/vrp105.c: Remove. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/switch-3.c Removed: trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp105.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-switch-conversion.c trunk/gcc/tree-switch-conversion.h