mirror of git://gcc.gnu.org/git/gcc.git
Fix emission of jump tables (PR tree-optimization/86263).
2018-06-22 Martin Liska <mliska@suse.cz>
PR tree-optimization/86263
* tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
Bail out if is_enabled is false.
* tree-switch-conversion.h (jump_table_cluster::is_enabled):
New declaration.
(jump_table_cluster::is_enabled): New function.
From-SVN: r261886
This commit is contained in:
parent
0c172706f4
commit
5885a1bd53
|
|
@ -1,3 +1,12 @@
|
||||||
|
2018-06-22 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
PR tree-optimization/86263
|
||||||
|
* tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
|
||||||
|
Bail out if is_enabled is false.
|
||||||
|
* tree-switch-conversion.h (jump_table_cluster::is_enabled):
|
||||||
|
New declaration.
|
||||||
|
(jump_table_cluster::is_enabled): New function.
|
||||||
|
|
||||||
2018-06-22 Jan Hubicka <hubicka@ucw.cz>
|
2018-06-22 Jan Hubicka <hubicka@ucw.cz>
|
||||||
|
|
||||||
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
|
* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
|
||||||
|
|
|
||||||
|
|
@ -1094,6 +1094,9 @@ jump_table_cluster::emit (tree index_expr, tree,
|
||||||
vec<cluster *>
|
vec<cluster *>
|
||||||
jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
|
jump_table_cluster::find_jump_tables (vec<cluster *> &clusters)
|
||||||
{
|
{
|
||||||
|
if (!is_enabled ())
|
||||||
|
return clusters.copy ();
|
||||||
|
|
||||||
unsigned l = clusters.length ();
|
unsigned l = clusters.length ();
|
||||||
auto_vec<min_cluster_item> min;
|
auto_vec<min_cluster_item> min;
|
||||||
min.reserve (l + 1);
|
min.reserve (l + 1);
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,9 @@ struct jump_table_cluster: public group_cluster
|
||||||
/* Return the smallest number of different values for which it is best
|
/* Return the smallest number of different values for which it is best
|
||||||
to use a jump-table instead of a tree of conditional branches. */
|
to use a jump-table instead of a tree of conditional branches. */
|
||||||
static inline unsigned int case_values_threshold (void);
|
static inline unsigned int case_values_threshold (void);
|
||||||
|
|
||||||
|
/* Return whether jump table expansion is allowed. */
|
||||||
|
static bool is_enabled (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A GIMPLE switch statement can be expanded to a short sequence of bit-wise
|
/* A GIMPLE switch statement can be expanded to a short sequence of bit-wise
|
||||||
|
|
@ -450,6 +453,23 @@ jump_table_cluster::case_values_threshold (void)
|
||||||
return threshold;
|
return threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return whether jump table expansion is allowed. */
|
||||||
|
bool jump_table_cluster::is_enabled (void)
|
||||||
|
{
|
||||||
|
/* If neither casesi or tablejump is available, or flag_jump_tables
|
||||||
|
over-ruled us, we really have no choice. */
|
||||||
|
if (!targetm.have_casesi () && !targetm.have_tablejump ())
|
||||||
|
return false;
|
||||||
|
if (!flag_jump_tables)
|
||||||
|
return false;
|
||||||
|
#ifndef ASM_OUTPUT_ADDR_DIFF_ELT
|
||||||
|
if (flag_pic)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* A case_bit_test represents a set of case nodes that may be
|
/* A case_bit_test represents a set of case nodes that may be
|
||||||
selected from using a bit-wise comparison. HI and LO hold
|
selected from using a bit-wise comparison. HI and LO hold
|
||||||
the integer to be tested against, TARGET_EDGE contains the
|
the integer to be tested against, TARGET_EDGE contains the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue