[4/4] Change default for jump_table expansion ratio to 8.

Message ID 20082c001c2e3a94646d79676a3cca257613849e.1528462860.git.mliska@suse.cz
State New
Headers show
Series
  • Implement smart multiple switch expansion algorithms
Related show

Commit Message

Martin Liška June 7, 2018, 9:04 a.m.
gcc/ChangeLog:

2018-06-07  Martin Liska  <mliska@suse.cz>

	* tree-switch-conversion.c (jump_table_cluster::can_be_handled):
        Change default ratio from 10 to 8.
---
 gcc/tree-switch-conversion.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Jeff Law June 12, 2018, 8:35 p.m. | #1
On 06/07/2018 03:04 AM, marxin wrote:
> 

> gcc/ChangeLog:

> 

> 2018-06-07  Martin Liska  <mliska@suse.cz>

> 

> 	* tree-switch-conversion.c (jump_table_cluster::can_be_handled):

>         Change default ratio from 10 to 8.

> ---

>  gcc/tree-switch-conversion.c | 10 ++--------

>  1 file changed, 2 insertions(+), 8 deletions(-)

> 

This is fine once the other patches in the series are approved.

jeff

Patch

diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 60181542bcc..5573f50d59f 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1075,17 +1075,11 @@  jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
      make a sequence of conditional branches instead of a dispatch.
 
      The definition of "much bigger" depends on whether we are
-     optimizing for size or for speed.  If the former, the maximum
-     ratio range/count = 3, because this was found to be the optimal
-     ratio for size on i686-pc-linux-gnu, see PR11823.  The ratio
-     10 is much older, and was probably selected after an extensive
-     benchmarking investigation on numerous platforms.  Or maybe it
-     just made sense to someone at some point in the history of GCC,
-     who knows...  */
+     optimizing for size or for speed.  */
   if (!flag_jump_tables)
     return false;
 
-  unsigned HOST_WIDE_INT max_ratio = optimize_insn_for_size_p () ? 3 : 10;
+  unsigned HOST_WIDE_INT max_ratio = optimize_insn_for_size_p () ? 3 : 8;
 
   unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (),
 					    clusters[end]->get_high ());