Commit d8bbf1d9 by Vladislav Ivanishin Committed by Vladislav Ivanishin

Don't split non-critical edges in crited

gcc/ChangeLog:

        * tree-cfg.h (split_critical_edges): Add for_edge_insertion_p
	parameter with default value false to declaration.
        (split_edges_for_insertion): New inline function.  Wrapper for
	split_critical_edges with for_edge_insertion_p = true.
        * tree-cfg.c (split_critical_edges): Don't split non-critical
	edges if for_edge_insertion_p is false.  Fix whitespace.
        * tree-ssa-pre.c (pass_pre::execute): Call
	split_edges_for_insertion instead of split_critical_edges.
        * gcc/tree-ssa-tail-merge.c (tail_merge_optimize): Ditto.
        * gcc/tree-ssa-sink.c (pass_sink_code::execute): Ditto.
	(pass_data_sink_code): Update function name in the comment.

From-SVN: r271461
parent 0f8e84c6
2019-05-21 Vladislav Ivanishin <vlad@ispras.ru> 2019-05-21 Vladislav Ivanishin <vlad@ispras.ru>
* tree-cfg.h (split_critical_edges): Add for_edge_insertion_p
parameter with default value false to declaration.
(split_edges_for_insertion): New inline function. Wrapper for
split_critical_edges with for_edge_insertion_p = true.
* tree-cfg.c (split_critical_edges): Don't split non-critical
edges if for_edge_insertion_p is false. Fix whitespace.
* tree-ssa-pre.c (pass_pre::execute): Call
split_edges_for_insertion instead of split_critical_edges.
* gcc/tree-ssa-tail-merge.c (tail_merge_optimize): Ditto.
* gcc/tree-ssa-sink.c (pass_sink_code::execute): Ditto.
(pass_data_sink_code): Update function name in the comment.
2019-05-21 Vladislav Ivanishin <vlad@ispras.ru>
* tree-ssa-uninit.c (value_sat_pred_p): This new function is a wrapper * tree-ssa-uninit.c (value_sat_pred_p): This new function is a wrapper
around is_value_included_in that knows how to handle BIT_AND_EXPR. around is_value_included_in that knows how to handle BIT_AND_EXPR.
(is_pred_expr_subset_of): Use the new function. Handle more cases where (is_pred_expr_subset_of): Use the new function. Handle more cases where
......
...@@ -8932,10 +8932,11 @@ struct cfg_hooks gimple_cfg_hooks = { ...@@ -8932,10 +8932,11 @@ struct cfg_hooks gimple_cfg_hooks = {
}; };
/* Split all critical edges. */ /* Split all critical edges. Split some extra (not necessarily critical) edges
if FOR_EDGE_INSERTION_P is true. */
unsigned int unsigned int
split_critical_edges (void) split_critical_edges (bool for_edge_insertion_p /* = false */)
{ {
basic_block bb; basic_block bb;
edge e; edge e;
...@@ -8958,11 +8959,12 @@ split_critical_edges (void) ...@@ -8958,11 +8959,12 @@ split_critical_edges (void)
end by control flow statements, such as RESX. end by control flow statements, such as RESX.
Go ahead and split them too. This matches the logic in Go ahead and split them too. This matches the logic in
gimple_find_edge_insert_loc. */ gimple_find_edge_insert_loc. */
else if ((!single_pred_p (e->dest) else if (for_edge_insertion_p
|| !gimple_seq_empty_p (phi_nodes (e->dest)) && (!single_pred_p (e->dest)
|| e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun)) || !gimple_seq_empty_p (phi_nodes (e->dest))
|| e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
&& e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun) && e->src != ENTRY_BLOCK_PTR_FOR_FN (cfun)
&& !(e->flags & EDGE_ABNORMAL)) && !(e->flags & EDGE_ABNORMAL))
{ {
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
......
...@@ -105,7 +105,7 @@ extern void extract_true_false_edges_from_block (basic_block, edge *, edge *); ...@@ -105,7 +105,7 @@ extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
extern tree find_case_label_for_value (const gswitch *switch_stmt, tree val); extern tree find_case_label_for_value (const gswitch *switch_stmt, tree val);
extern edge find_taken_edge_switch_expr (const gswitch *switch_stmt, tree val); extern edge find_taken_edge_switch_expr (const gswitch *switch_stmt, tree val);
extern unsigned int execute_fixup_cfg (void); extern unsigned int execute_fixup_cfg (void);
extern unsigned int split_critical_edges (void); extern unsigned int split_critical_edges (bool for_edge_insertion_p = false);
extern basic_block insert_cond_bb (basic_block, gimple *, gimple *, extern basic_block insert_cond_bb (basic_block, gimple *, gimple *,
profile_probability); profile_probability);
extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *); extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *);
...@@ -128,4 +128,11 @@ should_remove_lhs_p (tree lhs) ...@@ -128,4 +128,11 @@ should_remove_lhs_p (tree lhs)
&& !TREE_ADDRESSABLE (TREE_TYPE (lhs))); && !TREE_ADDRESSABLE (TREE_TYPE (lhs)));
} }
inline unsigned int
split_edges_for_insertion ()
{
return split_critical_edges (/*for_edge_insertion_p=*/true);
}
#endif /* _TREE_CFG_H */ #endif /* _TREE_CFG_H */
...@@ -4183,7 +4183,7 @@ pass_pre::execute (function *fun) ...@@ -4183,7 +4183,7 @@ pass_pre::execute (function *fun)
/* This has to happen before VN runs because /* This has to happen before VN runs because
loop_optimizer_init may create new phis, etc. */ loop_optimizer_init may create new phis, etc. */
loop_optimizer_init (LOOPS_NORMAL); loop_optimizer_init (LOOPS_NORMAL);
split_critical_edges (); split_edges_for_insertion ();
scev_initialize (); scev_initialize ();
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
......
...@@ -610,7 +610,7 @@ const pass_data pass_data_sink_code = ...@@ -610,7 +610,7 @@ const pass_data pass_data_sink_code =
"sink", /* name */ "sink", /* name */
OPTGROUP_NONE, /* optinfo_flags */ OPTGROUP_NONE, /* optinfo_flags */
TV_TREE_SINK, /* tv_id */ TV_TREE_SINK, /* tv_id */
/* PROP_no_crit_edges is ensured by running split_critical_edges in /* PROP_no_crit_edges is ensured by running split_edges_for_insertion in
pass_data_sink_code::execute (). */ pass_data_sink_code::execute (). */
( PROP_cfg | PROP_ssa ), /* properties_required */ ( PROP_cfg | PROP_ssa ), /* properties_required */
0, /* properties_provided */ 0, /* properties_provided */
...@@ -636,7 +636,7 @@ unsigned int ...@@ -636,7 +636,7 @@ unsigned int
pass_sink_code::execute (function *fun) pass_sink_code::execute (function *fun)
{ {
loop_optimizer_init (LOOPS_NORMAL); loop_optimizer_init (LOOPS_NORMAL);
split_critical_edges (); split_edges_for_insertion ();
connect_infinite_loops_to_exit (); connect_infinite_loops_to_exit ();
memset (&sink_stats, 0, sizeof (sink_stats)); memset (&sink_stats, 0, sizeof (sink_stats));
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
......
...@@ -1746,7 +1746,7 @@ tail_merge_optimize (unsigned int todo) ...@@ -1746,7 +1746,7 @@ tail_merge_optimize (unsigned int todo)
{ {
cleanup_tree_cfg (); cleanup_tree_cfg ();
todo &= ~TODO_cleanup_cfg; todo &= ~TODO_cleanup_cfg;
split_critical_edges (); split_edges_for_insertion ();
} }
if (!dom_info_available_p (CDI_DOMINATORS)) if (!dom_info_available_p (CDI_DOMINATORS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment