+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
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);
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. */
}
-
static pre_expr
phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock);
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)
fini_pre ()
{
value_expressions.release ();
+ expressions.release ();
BITMAP_FREE (inserted_exprs);
bitmap_obstack_release (&grand_bitmap_obstack);
bitmap_set_pool.release ();
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 ();
}
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. */