aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-05-10 08:32:31 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-05-10 06:32:31 +0000
commit26f36b50ead92836710b0ae799abaf4f000a6f88 (patch)
treeebe4443deb58864102d8c91e8577eabf00b2fdd5 /gcc/tree-switch-conversion.c
parent38613b9baa4237c8b730a63742ba606cb97f6a9f (diff)
Add params for jump-table expansion params (PR middle-end/90340).
2019-05-10 Martin Liska <mliska@suse.cz> PR middle-end/90340 * doc/invoke.texi: New params. * params.def (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SIZE): New. (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SPEED): Likewise. * tree-switch-conversion.c (jump_table_cluster::can_be_handled): Use it. * tree-switch-conversion.h (struct jump_table_cluster): Likewise. 2019-05-10 Martin Liska <mliska@suse.cz> PR middle-end/90340 * gcc.dg/tree-ssa/pr90340-2.c: New test. * gcc.dg/tree-ssa/pr90340.c: New test. From-SVN: r271053
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index c3f2baf39d7..bedeb2fd865 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1268,7 +1268,9 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
return true;
unsigned HOST_WIDE_INT max_ratio
- = optimize_insn_for_size_p () ? max_ratio_for_size : max_ratio_for_speed;
+ = (optimize_insn_for_size_p ()
+ ? PARAM_VALUE (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SIZE)
+ : PARAM_VALUE (PARAM_JUMP_TABLE_MAX_GROWTH_RATIO_FOR_SPEED));
unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (),
clusters[end]->get_high ());
/* Check overflow. */
@@ -1282,7 +1284,7 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
comparison_count += sc->m_range_p ? 2 : 1;
}
- return range <= max_ratio * comparison_count;
+ return 100 * range <= max_ratio * comparison_count;
}
/* Return true if cluster starting at START and ending at END (inclusive)
@@ -1299,11 +1301,6 @@ jump_table_cluster::is_beneficial (const vec<cluster *> &,
return end - start + 1 >= case_values_threshold ();
}
-/* Definition of jump_table_cluster constants. */
-
-const unsigned HOST_WIDE_INT jump_table_cluster::max_ratio_for_size;
-const unsigned HOST_WIDE_INT jump_table_cluster::max_ratio_for_speed;
-
/* Find bit tests of given CLUSTERS, where all members of the vector
are of type simple_cluster. New clusters are returned. */