cfgexpand.c (expand_gimple_cond): Remove check for current_loops.

2014-06-06  Richard Biener  <rguenther@suse.de>

	* cfgexpand.c (expand_gimple_cond): Remove check for current_loops.
	(construct_init_block): Likewise.
	(construct_exit_block): Likewise.
	(pass_expand::execute): Likewise.
	* graphite.c (graphite_transforms): Replace check for current_loops
	with a check for > 1 loops.
	(pass_graphite_transforms::execute): Adjust.
	* ipa-split.c (split_function): Remove check for current_loops.
	* omp-low.c (expand_parallel_call): Likewise.
	(expand_omp_for_init_counts): Likewise.
	(extract_omp_for_update_vars): Likewise.
	(expand_omp_for_generic): Likewise.
	(expand_omp_sections): Likewise.
	(expand_omp_target): Likewise.
	* tracer.c (tail_duplicate): Likewise.
	(pass_tracer::execute): Likewise.
	* trans-mem.c (expand_transaction): Likewise.
	* tree-complex.c (expand_complex_div_wide): Likewise.
	* tree-eh.c (lower_resx): Likewise.
	(cleanup_empty_eh_merge_phis): Likewise.
	* tree-predcom.c (run_tree_predictive_commoning): Replace check for
	current_loops with a check for > 1 loops.
	(pass_predcom::execute): Adjust.
	* tree-scalar-evolution.c (scev_reset): Remove check for current_loops.
	* tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
	* tree-ssa-dom.c (pass_phi_only_cprop::execute): Likewise.
	* tree-ssa-tail-merge.c (tail_merge_optimize): Likewise.
	* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
	* tree-switch-conversion.c (process_switch): Likewise.
	* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.
	* tree-vrp.c (vrp_visit_phi_node): Likewise.
	(execute_vrp): Likewise.
	* ubsan.c (ubsan_expand_null_ifn): Likewise.

From-SVN: r211306
This commit is contained in:
Richard Biener 2014-06-06 07:38:07 +00:00 committed by Richard Biener
parent ffa4602f4d
commit 726338f44e
19 changed files with 76 additions and 94 deletions

View File

@ -1,3 +1,39 @@
2014-06-06 Richard Biener <rguenther@suse.de>
* cfgexpand.c (expand_gimple_cond): Remove check for current_loops.
(construct_init_block): Likewise.
(construct_exit_block): Likewise.
(pass_expand::execute): Likewise.
* graphite.c (graphite_transforms): Replace check for current_loops
with a check for > 1 loops.
(pass_graphite_transforms::execute): Adjust.
* ipa-split.c (split_function): Remove check for current_loops.
* omp-low.c (expand_parallel_call): Likewise.
(expand_omp_for_init_counts): Likewise.
(extract_omp_for_update_vars): Likewise.
(expand_omp_for_generic): Likewise.
(expand_omp_sections): Likewise.
(expand_omp_target): Likewise.
* tracer.c (tail_duplicate): Likewise.
(pass_tracer::execute): Likewise.
* trans-mem.c (expand_transaction): Likewise.
* tree-complex.c (expand_complex_div_wide): Likewise.
* tree-eh.c (lower_resx): Likewise.
(cleanup_empty_eh_merge_phis): Likewise.
* tree-predcom.c (run_tree_predictive_commoning): Replace check for
current_loops with a check for > 1 loops.
(pass_predcom::execute): Adjust.
* tree-scalar-evolution.c (scev_reset): Remove check for current_loops.
* tree-ssa-copy.c (copy_prop_visit_phi_node): Likewise.
* tree-ssa-dom.c (pass_phi_only_cprop::execute): Likewise.
* tree-ssa-tail-merge.c (tail_merge_optimize): Likewise.
* tree-ssa-threadupdate.c (thread_through_all_blocks): Likewise.
* tree-switch-conversion.c (process_switch): Likewise.
* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.
* tree-vrp.c (vrp_visit_phi_node): Likewise.
(execute_vrp): Likewise.
* ubsan.c (ubsan_expand_null_ifn): Likewise.
2014-06-06 Eric Botcazou <ebotcazou@adacore.com>
* rtl.h (insn_location): Declare.

View File

@ -2170,8 +2170,7 @@ expand_gimple_cond (basic_block bb, gimple stmt)
false_edge->flags |= EDGE_FALLTHRU;
new_bb->count = false_edge->count;
new_bb->frequency = EDGE_FREQUENCY (false_edge);
if (current_loops && bb->loop_father)
add_bb_to_loop (new_bb, bb->loop_father);
add_bb_to_loop (new_bb, bb->loop_father);
new_edge = make_edge (new_bb, dest, 0);
new_edge->probability = REG_BR_PROB_BASE;
new_edge->count = new_bb->count;
@ -5273,8 +5272,7 @@ construct_init_block (void)
ENTRY_BLOCK_PTR_FOR_FN (cfun));
init_block->frequency = ENTRY_BLOCK_PTR_FOR_FN (cfun)->frequency;
init_block->count = ENTRY_BLOCK_PTR_FOR_FN (cfun)->count;
if (current_loops && ENTRY_BLOCK_PTR_FOR_FN (cfun)->loop_father)
add_bb_to_loop (init_block, ENTRY_BLOCK_PTR_FOR_FN (cfun)->loop_father);
add_bb_to_loop (init_block, ENTRY_BLOCK_PTR_FOR_FN (cfun)->loop_father);
if (e)
{
first_block = e->dest;
@ -5352,8 +5350,7 @@ construct_exit_block (void)
exit_block = create_basic_block (NEXT_INSN (head), end, prev_bb);
exit_block->frequency = EXIT_BLOCK_PTR_FOR_FN (cfun)->frequency;
exit_block->count = EXIT_BLOCK_PTR_FOR_FN (cfun)->count;
if (current_loops && EXIT_BLOCK_PTR_FOR_FN (cfun)->loop_father)
add_bb_to_loop (exit_block, EXIT_BLOCK_PTR_FOR_FN (cfun)->loop_father);
add_bb_to_loop (exit_block, EXIT_BLOCK_PTR_FOR_FN (cfun)->loop_father);
ix = 0;
while (ix < EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds))
@ -5815,8 +5812,7 @@ pass_expand::execute (function *fun)
timevar_push (TV_POST_EXPAND);
/* We are no longer in SSA form. */
fun->gimple_df->in_ssa_p = false;
if (current_loops)
loops_state_clear (LOOP_CLOSED_SSA);
loops_state_clear (LOOP_CLOSED_SSA);
/* Expansion is used by optimization passes too, set maybe_hot_insn_p
conservatively to true until they are all profile aware. */

View File

@ -324,9 +324,9 @@ graphite_transform_loops (void)
static unsigned int
graphite_transforms (void)
graphite_transforms (struct function *fun)
{
if (!current_loops)
if (number_of_loops (fun) <= 1)
return 0;
graphite_transform_loops ();
@ -411,7 +411,7 @@ public:
/* opt_pass methods: */
virtual bool gate (function *) { return gate_graphite_transforms (); }
virtual unsigned int execute (function *) { return graphite_transforms (); }
virtual unsigned int execute (function *fun) { return graphite_transforms (fun); }
}; // class pass_graphite_transforms

View File

@ -1177,8 +1177,7 @@ split_function (struct split_point *split_point)
e = make_edge (new_return_bb, EXIT_BLOCK_PTR_FOR_FN (cfun), 0);
e->probability = REG_BR_PROB_BASE;
e->count = new_return_bb->count;
if (current_loops)
add_bb_to_loop (new_return_bb, current_loops->tree_root);
add_bb_to_loop (new_return_bb, current_loops->tree_root);
bitmap_set_bit (split_point->split_bbs, new_return_bb->index);
}
/* When we pass around the value, use existing return block. */

View File

@ -4297,11 +4297,8 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
make_edge (cond_bb, else_bb, EDGE_FALSE_VALUE);
if (current_loops)
{
add_bb_to_loop (then_bb, cond_bb->loop_father);
add_bb_to_loop (else_bb, cond_bb->loop_father);
}
add_bb_to_loop (then_bb, cond_bb->loop_father);
add_bb_to_loop (else_bb, cond_bb->loop_father);
e_then = make_edge (then_bb, bb, EDGE_FALLTHRU);
e_else = make_edge (else_bb, bb, EDGE_FALLTHRU);
@ -5021,8 +5018,7 @@ expand_omp_for_init_counts (struct omp_for_data *fd, gimple_stmt_iterator *gsi,
{
first_zero_iter = i;
zero_iter_bb = create_empty_bb (entry_bb);
if (current_loops)
add_bb_to_loop (zero_iter_bb, entry_bb->loop_father);
add_bb_to_loop (zero_iter_bb, entry_bb->loop_father);
*gsi = gsi_after_labels (zero_iter_bb);
stmt = gimple_build_assign (fd->loop.n2,
build_zero_cst (type));
@ -5205,8 +5201,7 @@ extract_omp_for_update_vars (struct omp_for_data *fd, basic_block cont_bb,
tree vtype = TREE_TYPE (fd->loops[i].v);
bb = create_empty_bb (last_bb);
if (current_loops)
add_bb_to_loop (bb, last_bb->loop_father);
add_bb_to_loop (bb, last_bb->loop_father);
gsi = gsi_start_bb (bb);
if (i < fd->collapse - 1)
@ -5693,8 +5688,7 @@ expand_omp_for_generic (struct omp_region *region,
remove_edge (e);
make_edge (cont_bb, l2_bb, EDGE_FALSE_VALUE);
if (current_loops)
add_bb_to_loop (l2_bb, cont_bb->loop_father);
add_bb_to_loop (l2_bb, cont_bb->loop_father);
e = find_edge (cont_bb, l1_bb);
if (gimple_omp_for_combined_p (fd->for_stmt))
{
@ -7139,8 +7133,7 @@ expand_omp_sections (struct omp_region *region)
t = gimple_block_label (default_bb);
u = build_case_label (NULL, NULL, t);
make_edge (l0_bb, default_bb, 0);
if (current_loops)
add_bb_to_loop (default_bb, current_loops->tree_root);
add_bb_to_loop (default_bb, current_loops->tree_root);
stmt = gimple_build_switch (vmain, u, label_vec);
gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT);
@ -8084,11 +8077,8 @@ expand_omp_target (struct omp_region *region)
make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
make_edge (cond_bb, else_bb, EDGE_FALSE_VALUE);
if (current_loops)
{
add_bb_to_loop (then_bb, cond_bb->loop_father);
add_bb_to_loop (else_bb, cond_bb->loop_father);
}
add_bb_to_loop (then_bb, cond_bb->loop_father);
add_bb_to_loop (else_bb, cond_bb->loop_father);
make_edge (then_bb, new_bb, EDGE_FALLTHRU);
make_edge (else_bb, new_bb, EDGE_FALLTHRU);

View File

@ -316,8 +316,7 @@ tail_duplicate (void)
of all do { } while loops. Do not do that - it is
not profitable and it might create a loop with multiple
entries or at least rotate the loop. */
&& (!current_loops
|| bb2->loop_father->header != bb2))
&& bb2->loop_father->header != bb2)
{
edge e;
basic_block copy;
@ -419,8 +418,7 @@ pass_tracer::execute (function *fun)
{
free_dominance_info (CDI_DOMINATORS);
/* If we changed the CFG schedule loops for fixup by cleanup_cfg. */
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
loops_state_set (LOOPS_NEED_FIXUP);
}
if (dump_file)

View File

@ -2745,12 +2745,9 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
basic_block test_bb = create_empty_bb (transaction_bb);
basic_block code_bb = create_empty_bb (test_bb);
basic_block join_bb = create_empty_bb (code_bb);
if (current_loops && transaction_bb->loop_father)
{
add_bb_to_loop (test_bb, transaction_bb->loop_father);
add_bb_to_loop (code_bb, transaction_bb->loop_father);
add_bb_to_loop (join_bb, transaction_bb->loop_father);
}
add_bb_to_loop (test_bb, transaction_bb->loop_father);
add_bb_to_loop (code_bb, transaction_bb->loop_father);
add_bb_to_loop (join_bb, transaction_bb->loop_father);
if (region->restart_block == region->entry_block)
region->restart_block = test_bb;
@ -2791,8 +2788,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
if (abort_edge)
{
basic_block test_bb = create_empty_bb (transaction_bb);
if (current_loops && transaction_bb->loop_father)
add_bb_to_loop (test_bb, transaction_bb->loop_father);
add_bb_to_loop (test_bb, transaction_bb->loop_father);
if (region->restart_block == region->entry_block)
region->restart_block = test_bb;
@ -2834,8 +2830,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
if (inst_edge && uninst_edge)
{
basic_block test_bb = create_empty_bb (transaction_bb);
if (current_loops && transaction_bb->loop_father)
add_bb_to_loop (test_bb, transaction_bb->loop_father);
add_bb_to_loop (test_bb, transaction_bb->loop_father);
if (region->restart_block == region->entry_block)
region->restart_block = test_bb;
@ -2886,8 +2881,7 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
{
basic_block empty_bb = create_empty_bb (transaction_bb);
region->restart_block = empty_bb;
if (current_loops && transaction_bb->loop_father)
add_bb_to_loop (empty_bb, transaction_bb->loop_father);
add_bb_to_loop (empty_bb, transaction_bb->loop_father);
redirect_edge_pred (fallthru_edge, empty_bb);
make_edge (transaction_bb, empty_bb, EDGE_FALLTHRU);

View File

@ -1162,11 +1162,8 @@ expand_complex_div_wide (gimple_stmt_iterator *gsi, tree inner_type,
make_edge (bb_cond, bb_false, EDGE_FALSE_VALUE);
make_edge (bb_true, bb_join, EDGE_FALLTHRU);
make_edge (bb_false, bb_join, EDGE_FALLTHRU);
if (current_loops)
{
add_bb_to_loop (bb_true, bb_cond->loop_father);
add_bb_to_loop (bb_false, bb_cond->loop_father);
}
add_bb_to_loop (bb_true, bb_cond->loop_father);
add_bb_to_loop (bb_false, bb_cond->loop_father);
/* Update dominance info. Note that bb_join's data was
updated by split_block. */

View File

@ -3212,8 +3212,7 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map)
gimple_stmt_iterator gsi2;
new_bb = create_empty_bb (bb);
if (current_loops)
add_bb_to_loop (new_bb, bb->loop_father);
add_bb_to_loop (new_bb, bb->loop_father);
lab = gimple_block_label (new_bb);
gsi2 = gsi_start_bb (new_bb);
@ -4210,8 +4209,7 @@ cleanup_empty_eh_merge_phis (basic_block new_bb, basic_block old_bb,
we may have created a loop with multiple latches.
All of this isn't easily fixed thus cancel the affected loop
and mark the other loop as possibly having multiple latches. */
if (current_loops
&& e->dest == e->dest->loop_father->header)
if (e->dest == e->dest->loop_father->header)
{
e->dest->loop_father->header = NULL;
e->dest->loop_father->latch = NULL;

View File

@ -2565,9 +2565,9 @@ tree_predictive_commoning (void)
/* Predictive commoning Pass. */
static unsigned
run_tree_predictive_commoning (void)
run_tree_predictive_commoning (struct function *fun)
{
if (!current_loops)
if (number_of_loops (fun) <= 1)
return 0;
return tree_predictive_commoning ();
@ -2598,9 +2598,9 @@ public:
/* opt_pass methods: */
virtual bool gate (function *) { return flag_predictive_commoning != 0; }
virtual unsigned int execute (function *)
virtual unsigned int execute (function *fun)
{
return run_tree_predictive_commoning ();
return run_tree_predictive_commoning (fun);
}
}; // class pass_predcom

View File

@ -3197,9 +3197,6 @@ scev_reset (void)
scev_reset_htab ();
if (!current_loops)
return;
FOR_EACH_LOOP (loop, 0)
{
loop->nb_iterations = NULL_TREE;

View File

@ -406,8 +406,7 @@ copy_prop_visit_phi_node (gimple phi)
??? The value will be always loop invariant.
In loop-closed SSA form do not copy-propagate through
PHI nodes in blocks with a loop exit edge predecessor. */
if (current_loops
&& TREE_CODE (arg_value) == SSA_NAME
if (TREE_CODE (arg_value) == SSA_NAME
&& (loop_depth_of_name (arg_value) > loop_depth_of_name (lhs)
|| (loops_state_satisfies_p (LOOP_CLOSED_SSA)
&& loop_exit_edge_p (e->src->loop_father, e))))

View File

@ -3128,8 +3128,7 @@ pass_phi_only_cprop::execute (function *fun)
{
free_dominance_info (CDI_DOMINATORS);
/* If we changed the CFG schedule loops for fixup by cfgcleanup. */
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
loops_state_set (LOOPS_NEED_FIXUP);
}
/* Propagation of const and copies may make some EH edges dead. Purge

View File

@ -1656,18 +1656,7 @@ tail_merge_optimize (unsigned int todo)
int max_iterations = PARAM_VALUE (PARAM_MAX_TAIL_MERGE_ITERATIONS);
if (!flag_tree_tail_merge
|| max_iterations == 0
/* We try to be conservative with respect to loop structure, since:
- the cases where tail-merging could both affect loop structure and be
beneficial are rare,
- it prevents us from having to fixup the loops using
loops_state_set (LOOPS_NEED_FIXUP), and
- keeping loop structure may allow us to simplify the pass.
In order to be conservative, we need loop information. In rare cases
(about 7 test-cases in the g++ testsuite) there is none (because
loop_optimizer_finalize has been called before tail-merge, and
PROP_loops is not set), so we bail out. */
|| current_loops == NULL)
|| max_iterations == 0)
return 0;
timevar_push (TV_TREE_TAIL_MERGE);

View File

@ -1707,9 +1707,6 @@ thread_through_all_blocks (bool may_peel_loop_headers)
bitmap threaded_blocks;
struct loop *loop;
/* We must know about loops in order to preserve them. */
gcc_assert (current_loops != NULL);
if (!paths.exists ())
return false;

View File

@ -1370,8 +1370,7 @@ process_switch (gimple swtch)
fputs (" expanding as bit test is preferable\n", dump_file);
emit_case_bit_tests (swtch, info.index_expr,
info.range_min, info.range_size);
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
loops_state_set (LOOPS_NEED_FIXUP);
return NULL;
}

View File

@ -1059,8 +1059,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
if (changed)
{
/* We may have created new loops. Make them magically appear. */
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
loops_state_set (LOOPS_NEED_FIXUP);
free_dominance_info (CDI_DOMINATORS);
}

View File

@ -8383,7 +8383,6 @@ vrp_visit_phi_node (gimple phi)
PHI node SCEV may known more about its value-range. */
if ((cmp_min > 0 || cmp_min < 0
|| cmp_max < 0 || cmp_max > 0)
&& current_loops
&& (l = loop_containing_stmt (phi))
&& l->header == gimple_bb (phi))
adjust_range_with_scev (&vr_result, l, phi, lhs);
@ -9784,8 +9783,7 @@ execute_vrp (void)
if (to_remove_edges.length () > 0)
{
free_dominance_info (CDI_DOMINATORS);
if (current_loops)
loops_state_set (LOOPS_NEED_FIXUP);
loops_state_set (LOOPS_NEED_FIXUP);
}
to_remove_edges.release ();

View File

@ -571,11 +571,8 @@ ubsan_expand_null_ifn (gimple_stmt_iterator gsi)
basic_block cond_bb = e->src;
basic_block fallthru_bb = e->dest;
basic_block then_bb = create_empty_bb (cond_bb);
if (current_loops)
{
add_bb_to_loop (then_bb, cond_bb->loop_father);
loops_state_set (LOOPS_NEED_FIXUP);
}
add_bb_to_loop (then_bb, cond_bb->loop_father);
loops_state_set (LOOPS_NEED_FIXUP);
/* Make an edge coming from the 'cond block' into the 'then block';
this edge is unlikely taken, so set up the probability accordingly. */