Commit 608c0f63 by Richard Biener Committed by Richard Biener

gimple-iterator.c (gimple_find_edge_insert_loc): Ignore fake edges to exit when…

gimple-iterator.c (gimple_find_edge_insert_loc): Ignore fake edges to exit when looking for a place to insert.

2017-11-22  Richard Biener  <rguenther@suse.de>

	* gimple-iterator.c (gimple_find_edge_insert_loc): Ignore
	fake edges to exit when looking for a place to insert.
	* tree-ssa-pre.c (clear_expression_ids): Inline into callers
	and remove.
	(insert_into_preds_of_block): Commit edge insertion immediately,
	assert that doesn't require new BBs.
	(fini_pre): Release expressions.
	(pass_pre::execute): Shuffle things around a bit, if the fn
	is too large do not compute AVAIL either as this is really the
	quadratic bit.

From-SVN: r255047
parent 9cf7bfd9
2017-11-22 Richard Biener <rguenther@suse.de>
* gimple-iterator.c (gimple_find_edge_insert_loc): Ignore
fake edges to exit when looking for a place to insert.
* tree-ssa-pre.c (clear_expression_ids): Inline into callers
and remove.
(insert_into_preds_of_block): Commit edge insertion immediately,
assert that doesn't require new BBs.
(fini_pre): Release expressions.
(pass_pre::execute): Shuffle things around a bit, if the fn
is too large do not compute AVAIL either as this is really the
quadratic bit.
2017-11-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/83089
* tree-if-conv.c (pass_if_conversion::execute): If anything
changed reset SCEV and free the number of iteration estimates.
......@@ -763,7 +763,12 @@ gimple_find_edge_insert_loc (edge e, gimple_stmt_iterator *gsi,
Except for the entry block. */
src = e->src;
if ((e->flags & EDGE_ABNORMAL) == 0
&& single_succ_p (src)
&& (single_succ_p (src)
/* Do not count a fake edge as successor as added to infinite
loops by connect_infinite_loops_to_exit. */
|| (EDGE_COUNT (src->succs) == 2
&& (EDGE_SUCC (src, 0)->flags & EDGE_FAKE
|| EDGE_SUCC (src, 1)->flags & EDGE_FAKE)))
&& src != ENTRY_BLOCK_PTR_FOR_FN (cfun))
{
*gsi = gsi_last_bb (src);
......
......@@ -400,15 +400,6 @@ expression_for_id (unsigned int id)
return expressions[id];
}
/* Free the expression id field in all of our expressions,
and then destroy the expressions array. */
static void
clear_expression_ids (void)
{
expressions.release ();
}
static object_allocator<pre_expr_d> pre_expr_pool ("pre_expr nodes");
/* Given an SSA_NAME NAME, get or create a pre_expr to represent it. */
......@@ -1331,7 +1322,6 @@ get_representative_for (const pre_expr e)
}
static pre_expr
phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock);
......@@ -3004,7 +2994,8 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
gcc_assert (!(pred->flags & EDGE_ABNORMAL));
if (!gimple_seq_empty_p (stmts))
{
gsi_insert_seq_on_edge (pred, stmts);
basic_block new_bb = gsi_insert_seq_on_edge_immediate (pred, stmts);
gcc_assert (! new_bb);
insertions = true;
}
if (!builtexpr)
......@@ -4127,6 +4118,7 @@ static void
fini_pre ()
{
value_expressions.release ();
expressions.release ();
BITMAP_FREE (inserted_exprs);
bitmap_obstack_release (&grand_bitmap_obstack);
bitmap_set_pool.release ();
......@@ -4181,22 +4173,21 @@ pass_pre::execute (function *fun)
loop_optimizer_init may create new phis, etc. */
loop_optimizer_init (LOOPS_NORMAL);
split_critical_edges ();
scev_initialize ();
run_scc_vn (VN_WALK);
init_pre ();
scev_initialize ();
/* Collect and value number expressions computed in each basic block. */
compute_avail ();
/* Insert can get quite slow on an incredibly large number of basic
blocks due to some quadratic behavior. Until this behavior is
fixed, don't run it when he have an incredibly large number of
bb's. If we aren't going to run insert, there is no point in
computing ANTIC, either, even though it's plenty fast. */
computing ANTIC, either, even though it's plenty fast nor do
we require AVAIL. */
if (n_basic_blocks_for_fn (fun) < 4000)
{
compute_avail ();
compute_antic ();
insert ();
}
......@@ -4211,19 +4202,19 @@ pass_pre::execute (function *fun)
not keeping virtual operands up-to-date. */
gcc_assert (!need_ssa_update_p (fun));
/* Remove all the redundant expressions. */
todo |= vn_eliminate (inserted_exprs);
statistics_counter_event (fun, "Insertions", pre_stats.insertions);
statistics_counter_event (fun, "PA inserted", pre_stats.pa_insert);
statistics_counter_event (fun, "HOIST inserted", pre_stats.hoist_insert);
statistics_counter_event (fun, "New PHIs", pre_stats.phis);
clear_expression_ids ();
/* Remove all the redundant expressions. */
todo |= vn_eliminate (inserted_exprs);
scev_finalize ();
remove_dead_inserted_code ();
fini_pre ();
scev_finalize ();
loop_optimizer_finalize ();
/* Restore SSA info before tail-merging as that resets it as well. */
......
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