Commit d51157de by Zdenek Dvorak Committed by Zdenek Dvorak

tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL.

	* tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL.
	* tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
	* ifcvt.c (if_convert): Ditto.
	* tree-ssa-threadupdate.c (thread_block): Ditto.
	(thread_through_all_blocks): Ditto.  Assert that loops were analysed.
	* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
	verify_loop_closed_ssa): Check number_of_loops instead of current_loops.
	* predict.c (tree_estimate_probability): Ditto.
	* tree-if-conv.c (main_tree_if_conversion): Ditto.
	* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
	* modulo-sched.c (sms_schedule): Ditto.
	* tree-scalar-evolution.c (scev_const_prop): Ditto.
	(scev_finalize): Do not do anything if scev analysis was not
	initialized.
	* cfgloopanal.c (mark_irreducible_loops): Do not check whether
	current_loops == NULL.
	(mark_loop_exit_edges): Check number_of_loops instead of current_loops.
	* loop-init.c (loop_optimizer_init): Do not free current_loops when
	there are no loops.
	(loop_optimizer_finalize): Assert that loops were analyzed.
	(rtl_move_loop_invariants, rtl_unswitch, rtl_unroll_and_peel_loops,
	rtl_doloop): Check number_of_loops instead of current_loops.
	* tree-ssa-loop.c (tree_loop_optimizer_init): Do not check whether
	current_loops == NULL.
	(tree_ssa_loop_init, tree_ssa_loop_im, tree_ssa_loop_unswitch,
	gate_tree_vectorize tree_linear_transform, check_data_deps,
	tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
	tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts):
	Check number_of_loops instead of current_loops.
	(tree_ssa_loop_done): Do not check whether current_loops == NULL.
	* tree-ssa-pre.c (fini_pre): Do not take do_fre argument.  Always
	free loops if available.
	(execute_pre): Do not pass do_fre to fini_pre.

From-SVN: r125114
parent 67a7356b
2007-05-27 Zdenek Dvorak <dvorakz@suse.cz>
* tree-vrp.c (execute_vrp): Do not check whether current_loops == NULL.
* tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-threadupdate.c (thread_block): Ditto.
(thread_through_all_blocks): Ditto. Assert that loops were analysed.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
verify_loop_closed_ssa): Check number_of_loops instead of current_loops.
* predict.c (tree_estimate_probability): Ditto.
* tree-if-conv.c (main_tree_if_conversion): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-scalar-evolution.c (scev_const_prop): Ditto.
(scev_finalize): Do not do anything if scev analysis was not
initialized.
* cfgloopanal.c (mark_irreducible_loops): Do not check whether
current_loops == NULL.
(mark_loop_exit_edges): Check number_of_loops instead of current_loops.
* loop-init.c (loop_optimizer_init): Do not free current_loops when
there are no loops.
(loop_optimizer_finalize): Assert that loops were analyzed.
(rtl_move_loop_invariants, rtl_unswitch, rtl_unroll_and_peel_loops,
rtl_doloop): Check number_of_loops instead of current_loops.
* tree-ssa-loop.c (tree_loop_optimizer_init): Do not check whether
current_loops == NULL.
(tree_ssa_loop_init, tree_ssa_loop_im, tree_ssa_loop_unswitch,
gate_tree_vectorize tree_linear_transform, check_data_deps,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts):
Check number_of_loops instead of current_loops.
(tree_ssa_loop_done): Do not check whether current_loops == NULL.
* tree-ssa-pre.c (fini_pre): Do not take do_fre argument. Always
free loops if available.
(execute_pre): Do not pass do_fre to fini_pre.
2007-05-27 Tobias Burnus <burnus@net-b.de> 2007-05-27 Tobias Burnus <burnus@net-b.de>
PR middle-end/32083 PR middle-end/32083
......
...@@ -273,7 +273,7 @@ mark_irreducible_loops (void) ...@@ -273,7 +273,7 @@ mark_irreducible_loops (void)
edge_iterator ei; edge_iterator ei;
int i, src, dest; int i, src, dest;
struct graph *g; struct graph *g;
int num = current_loops ? number_of_loops () : 1; int num = number_of_loops ();
int *queue1 = XNEWVEC (int, last_basic_block + num); int *queue1 = XNEWVEC (int, last_basic_block + num);
int *queue2 = XNEWVEC (int, last_basic_block + num); int *queue2 = XNEWVEC (int, last_basic_block + num);
int nq; int nq;
...@@ -281,6 +281,8 @@ mark_irreducible_loops (void) ...@@ -281,6 +281,8 @@ mark_irreducible_loops (void)
struct loop *cloop, *loop; struct loop *cloop, *loop;
loop_iterator li; loop_iterator li;
gcc_assert (current_loops != NULL);
/* Reset the flags. */ /* Reset the flags. */
FOR_BB_BETWEEN (act, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) FOR_BB_BETWEEN (act, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
{ {
...@@ -302,36 +304,32 @@ mark_irreducible_loops (void) ...@@ -302,36 +304,32 @@ mark_irreducible_loops (void)
src = BB_REPR (act); src = BB_REPR (act);
dest = BB_REPR (e->dest); dest = BB_REPR (e->dest);
if (current_loops) /* Ignore latch edges. */
{ if (e->dest->loop_father->header == e->dest
/* Ignore latch edges. */ && e->dest->loop_father->latch == act)
if (e->dest->loop_father->header == e->dest continue;
&& e->dest->loop_father->latch == act)
continue; /* Edges inside a single loop should be left where they are. Edges
to subloop headers should lead to representative of the subloop,
but from the same place.
/* Edges inside a single loop should be left where they are. Edges Edges exiting loops should lead from representative
to subloop headers should lead to representative of the subloop, of the son of nearest common ancestor of the loops in that
but from the same place. act lays. */
Edges exiting loops should lead from representative if (e->dest->loop_father->header == e->dest)
of the son of nearest common ancestor of the loops in that dest = LOOP_REPR (e->dest->loop_father);
act lays. */
if (!flow_bb_inside_loop_p (act->loop_father, e->dest))
if (e->dest->loop_father->header == e->dest) {
dest = LOOP_REPR (e->dest->loop_father); depth = 1 + loop_depth (find_common_loop (act->loop_father,
e->dest->loop_father));
if (!flow_bb_inside_loop_p (act->loop_father, e->dest)) if (depth == loop_depth (act->loop_father))
{ cloop = act->loop_father;
depth = 1 + loop_depth (find_common_loop (act->loop_father, else
e->dest->loop_father)); cloop = VEC_index (loop_p, act->loop_father->superloops, depth);
if (depth == loop_depth (act->loop_father))
cloop = act->loop_father; src = LOOP_REPR (cloop);
else
cloop = VEC_index (loop_p, act->loop_father->superloops,
depth);
src = LOOP_REPR (cloop);
}
} }
add_edge (g, src, dest, e); add_edge (g, src, dest, e);
...@@ -347,12 +345,9 @@ mark_irreducible_loops (void) ...@@ -347,12 +345,9 @@ mark_irreducible_loops (void)
queue1[nq++] = BB_REPR (act); queue1[nq++] = BB_REPR (act);
} }
if (current_loops) FOR_EACH_LOOP (li, loop, 0)
{ {
FOR_EACH_LOOP (li, loop, 0) queue1[nq++] = LOOP_REPR (loop);
{
queue1[nq++] = LOOP_REPR (loop);
}
} }
dfs (g, queue1, nq, queue2, false); dfs (g, queue1, nq, queue2, false);
for (i = 0; i < nq; i++) for (i = 0; i < nq; i++)
...@@ -366,8 +361,7 @@ mark_irreducible_loops (void) ...@@ -366,8 +361,7 @@ mark_irreducible_loops (void)
free (queue1); free (queue1);
free (queue2); free (queue2);
if (current_loops) current_loops->state |= LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS;
current_loops->state |= LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS;
} }
/* Counts number of insns inside LOOP. */ /* Counts number of insns inside LOOP. */
...@@ -605,7 +599,7 @@ mark_loop_exit_edges (void) ...@@ -605,7 +599,7 @@ mark_loop_exit_edges (void)
basic_block bb; basic_block bb;
edge e; edge e;
if (!current_loops) if (number_of_loops () <= 1)
return; return;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
......
...@@ -3953,11 +3953,8 @@ if_convert (int x_life_data_ok) ...@@ -3953,11 +3953,8 @@ if_convert (int x_life_data_ok)
gcc_assert (! no_new_pseudos || reload_completed); gcc_assert (! no_new_pseudos || reload_completed);
loop_optimizer_init (AVOID_CFG_MODIFICATIONS); loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
if (current_loops) mark_loop_exit_edges ();
{ loop_optimizer_finalize ();
mark_loop_exit_edges ();
loop_optimizer_finalize ();
}
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);
/* Compute postdominators if we think we'll use them. */ /* Compute postdominators if we think we'll use them. */
......
...@@ -51,14 +51,6 @@ loop_optimizer_init (unsigned flags) ...@@ -51,14 +51,6 @@ loop_optimizer_init (unsigned flags)
flow_loops_find (loops); flow_loops_find (loops);
current_loops = loops; current_loops = loops;
if (number_of_loops () <= 1)
{
/* No loops (the 1 returned by number_of_loops corresponds to the fake
loop that we put as a root of the loop tree). */
loop_optimizer_finalize ();
return;
}
if (flags & LOOPS_MAY_HAVE_MULTIPLE_LATCHES) if (flags & LOOPS_MAY_HAVE_MULTIPLE_LATCHES)
{ {
/* If the loops may have multiple latches, we cannot canonicalize /* If the loops may have multiple latches, we cannot canonicalize
...@@ -105,8 +97,7 @@ loop_optimizer_finalize (void) ...@@ -105,8 +97,7 @@ loop_optimizer_finalize (void)
struct loop *loop; struct loop *loop;
basic_block bb; basic_block bb;
if (!current_loops) gcc_assert (current_loops != NULL);
return;
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
{ {
...@@ -244,7 +235,7 @@ gate_rtl_move_loop_invariants (void) ...@@ -244,7 +235,7 @@ gate_rtl_move_loop_invariants (void)
static unsigned int static unsigned int
rtl_move_loop_invariants (void) rtl_move_loop_invariants (void)
{ {
if (current_loops) if (number_of_loops () > 1)
move_loop_invariants (); move_loop_invariants ();
return 0; return 0;
} }
...@@ -277,7 +268,7 @@ gate_rtl_unswitch (void) ...@@ -277,7 +268,7 @@ gate_rtl_unswitch (void)
static unsigned int static unsigned int
rtl_unswitch (void) rtl_unswitch (void)
{ {
if (current_loops) if (number_of_loops () > 1)
unswitch_loops (); unswitch_loops ();
return 0; return 0;
} }
...@@ -310,7 +301,7 @@ gate_rtl_unroll_and_peel_loops (void) ...@@ -310,7 +301,7 @@ gate_rtl_unroll_and_peel_loops (void)
static unsigned int static unsigned int
rtl_unroll_and_peel_loops (void) rtl_unroll_and_peel_loops (void)
{ {
if (current_loops) if (number_of_loops () > 1)
{ {
int flags = 0; int flags = 0;
...@@ -359,7 +350,7 @@ static unsigned int ...@@ -359,7 +350,7 @@ static unsigned int
rtl_doloop (void) rtl_doloop (void)
{ {
#ifdef HAVE_doloop_end #ifdef HAVE_doloop_end
if (current_loops) if (number_of_loops () > 1)
doloop_optimize_loops (); doloop_optimize_loops ();
#endif #endif
return 0; return 0;
......
...@@ -893,8 +893,11 @@ sms_schedule (void) ...@@ -893,8 +893,11 @@ sms_schedule (void)
loop_optimizer_init (LOOPS_HAVE_PREHEADERS loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_RECORDED_EXITS); | LOOPS_HAVE_RECORDED_EXITS);
if (!current_loops) if (number_of_loops () <= 1)
return; /* There are no loops to schedule. */ {
loop_optimizer_finalize ();
return; /* There are no loops to schedule. */
}
/* Initialize issue_rate. */ /* Initialize issue_rate. */
if (targetm.sched.issue_rate) if (targetm.sched.issue_rate)
......
...@@ -1353,7 +1353,7 @@ tree_estimate_probability (void) ...@@ -1353,7 +1353,7 @@ tree_estimate_probability (void)
basic_block bb; basic_block bb;
loop_optimizer_init (0); loop_optimizer_init (0);
if (current_loops && dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
flow_loops_dump (dump_file, NULL, 0); flow_loops_dump (dump_file, NULL, 0);
add_noreturn_fake_exit_edges (); add_noreturn_fake_exit_edges ();
...@@ -1368,7 +1368,7 @@ tree_estimate_probability (void) ...@@ -1368,7 +1368,7 @@ tree_estimate_probability (void)
mark_irreducible_loops (); mark_irreducible_loops ();
record_loop_exits (); record_loop_exits ();
if (current_loops) if (number_of_loops () > 1)
predict_loops (); predict_loops ();
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -1731,7 +1731,7 @@ estimate_loops (void) ...@@ -1731,7 +1731,7 @@ estimate_loops (void)
basic_block bb; basic_block bb;
/* Start by estimating the frequencies in the loops. */ /* Start by estimating the frequencies in the loops. */
if (current_loops) if (number_of_loops () > 1)
estimate_loops_at_level (current_loops->tree_root->inner); estimate_loops_at_level (current_loops->tree_root->inner);
/* Now propagate the frequencies through all the blocks. */ /* Now propagate the frequencies through all the blocks. */
......
...@@ -974,13 +974,7 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum) ...@@ -974,13 +974,7 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
bool bool
evolution_function_is_invariant_p (tree chrec, int loopnum) evolution_function_is_invariant_p (tree chrec, int loopnum)
{ {
if (evolution_function_is_constant_p (chrec)) return evolution_function_is_invariant_rec_p (chrec, loopnum);
return true;
if (current_loops != NULL)
return evolution_function_is_invariant_rec_p (chrec, loopnum);
return false;
} }
/* Determine whether the given tree is an affine multivariate /* Determine whether the given tree is an affine multivariate
......
...@@ -1105,7 +1105,7 @@ main_tree_if_conversion (void) ...@@ -1105,7 +1105,7 @@ main_tree_if_conversion (void)
loop_iterator li; loop_iterator li;
struct loop *loop; struct loop *loop;
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
......
...@@ -2863,6 +2863,8 @@ scev_analysis (void) ...@@ -2863,6 +2863,8 @@ scev_analysis (void)
void void
scev_finalize (void) scev_finalize (void)
{ {
if (!scalar_evolution_info)
return;
htab_delete (scalar_evolution_info); htab_delete (scalar_evolution_info);
BITMAP_FREE (already_instantiated); BITMAP_FREE (already_instantiated);
scalar_evolution_info = NULL; scalar_evolution_info = NULL;
...@@ -2885,7 +2887,7 @@ scev_const_prop (void) ...@@ -2885,7 +2887,7 @@ scev_const_prop (void)
unsigned i; unsigned i;
loop_iterator li; loop_iterator li;
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
......
...@@ -133,8 +133,11 @@ copy_loop_headers (void) ...@@ -133,8 +133,11 @@ copy_loop_headers (void)
loop_optimizer_init (LOOPS_HAVE_PREHEADERS loop_optimizer_init (LOOPS_HAVE_PREHEADERS
| LOOPS_HAVE_SIMPLE_LATCHES); | LOOPS_HAVE_SIMPLE_LATCHES);
if (!current_loops) if (number_of_loops () <= 1)
return 0; {
loop_optimizer_finalize ();
return 0;
}
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_loop_structure (); verify_loop_structure ();
......
...@@ -360,7 +360,8 @@ rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag) ...@@ -360,7 +360,8 @@ rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag)
unsigned i, old_num_ssa_names; unsigned i, old_num_ssa_names;
bitmap names_to_rename; bitmap names_to_rename;
if (!current_loops) current_loops->state |= LOOP_CLOSED_SSA;
if (number_of_loops () <= 1)
return; return;
loop_exits = get_loops_exits (); loop_exits = get_loops_exits ();
...@@ -389,8 +390,6 @@ rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag) ...@@ -389,8 +390,6 @@ rewrite_into_loop_closed_ssa (bitmap changed_bbs, unsigned update_flag)
/* Fix up all the names found to be used outside their original /* Fix up all the names found to be used outside their original
loops. */ loops. */
update_ssa (TODO_update_ssa); update_ssa (TODO_update_ssa);
current_loops->state |= LOOP_CLOSED_SSA;
} }
/* Check invariants of the loop closed ssa form for the USE in BB. */ /* Check invariants of the loop closed ssa form for the USE in BB. */
...@@ -432,7 +431,7 @@ verify_loop_closed_ssa (void) ...@@ -432,7 +431,7 @@ verify_loop_closed_ssa (void)
tree phi; tree phi;
unsigned i; unsigned i;
if (current_loops == NULL) if (number_of_loops () <= 1)
return; return;
verify_ssa (false); verify_ssa (false);
......
...@@ -45,9 +45,6 @@ tree_loop_optimizer_init (void) ...@@ -45,9 +45,6 @@ tree_loop_optimizer_init (void)
{ {
loop_optimizer_init (LOOPS_NORMAL loop_optimizer_init (LOOPS_NORMAL
| LOOPS_HAVE_RECORDED_EXITS); | LOOPS_HAVE_RECORDED_EXITS);
if (!current_loops)
return;
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa); rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
} }
...@@ -82,7 +79,7 @@ static unsigned int ...@@ -82,7 +79,7 @@ static unsigned int
tree_ssa_loop_init (void) tree_ssa_loop_init (void)
{ {
tree_loop_optimizer_init (); tree_loop_optimizer_init ();
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
scev_initialize (); scev_initialize ();
...@@ -111,7 +108,7 @@ struct tree_opt_pass pass_tree_loop_init = ...@@ -111,7 +108,7 @@ struct tree_opt_pass pass_tree_loop_init =
static unsigned int static unsigned int
tree_ssa_loop_im (void) tree_ssa_loop_im (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
tree_ssa_lim (); tree_ssa_lim ();
...@@ -146,7 +143,7 @@ struct tree_opt_pass pass_lim = ...@@ -146,7 +143,7 @@ struct tree_opt_pass pass_lim =
static unsigned int static unsigned int
tree_ssa_loop_unswitch (void) tree_ssa_loop_unswitch (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
return tree_ssa_unswitch_loops (); return tree_ssa_unswitch_loops ();
...@@ -223,7 +220,7 @@ tree_vectorize (void) ...@@ -223,7 +220,7 @@ tree_vectorize (void)
static bool static bool
gate_tree_vectorize (void) gate_tree_vectorize (void)
{ {
return flag_tree_vectorize && current_loops; return flag_tree_vectorize && number_of_loops () > 1;
} }
struct tree_opt_pass pass_vectorize = struct tree_opt_pass pass_vectorize =
...@@ -249,7 +246,7 @@ struct tree_opt_pass pass_vectorize = ...@@ -249,7 +246,7 @@ struct tree_opt_pass pass_vectorize =
static unsigned int static unsigned int
tree_linear_transform (void) tree_linear_transform (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
linear_transform_loops (); linear_transform_loops ();
...@@ -285,7 +282,7 @@ struct tree_opt_pass pass_linear_transform = ...@@ -285,7 +282,7 @@ struct tree_opt_pass pass_linear_transform =
static unsigned int static unsigned int
check_data_deps (void) check_data_deps (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
tree_check_data_deps (); tree_check_data_deps ();
...@@ -320,7 +317,7 @@ struct tree_opt_pass pass_check_data_deps = ...@@ -320,7 +317,7 @@ struct tree_opt_pass pass_check_data_deps =
static unsigned int static unsigned int
tree_ssa_loop_ivcanon (void) tree_ssa_loop_ivcanon (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
return canonicalize_induction_variables (); return canonicalize_induction_variables ();
...@@ -381,7 +378,7 @@ struct tree_opt_pass pass_scev_cprop = ...@@ -381,7 +378,7 @@ struct tree_opt_pass pass_scev_cprop =
static unsigned int static unsigned int
tree_ssa_empty_loop (void) tree_ssa_empty_loop (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
return remove_empty_loops (); return remove_empty_loops ();
...@@ -410,7 +407,7 @@ struct tree_opt_pass pass_empty_loop = ...@@ -410,7 +407,7 @@ struct tree_opt_pass pass_empty_loop =
static unsigned int static unsigned int
tree_ssa_loop_bounds (void) tree_ssa_loop_bounds (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
estimate_numbers_of_iterations (); estimate_numbers_of_iterations ();
...@@ -440,7 +437,7 @@ struct tree_opt_pass pass_record_bounds = ...@@ -440,7 +437,7 @@ struct tree_opt_pass pass_record_bounds =
static unsigned int static unsigned int
tree_complete_unroll (void) tree_complete_unroll (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
return tree_unroll_loops_completely (flag_unroll_loops return tree_unroll_loops_completely (flag_unroll_loops
...@@ -477,7 +474,7 @@ struct tree_opt_pass pass_complete_unroll = ...@@ -477,7 +474,7 @@ struct tree_opt_pass pass_complete_unroll =
static unsigned int static unsigned int
tree_ssa_loop_prefetch (void) tree_ssa_loop_prefetch (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
return tree_ssa_prefetch_arrays (); return tree_ssa_prefetch_arrays ();
...@@ -511,7 +508,7 @@ struct tree_opt_pass pass_loop_prefetch = ...@@ -511,7 +508,7 @@ struct tree_opt_pass pass_loop_prefetch =
static unsigned int static unsigned int
tree_ssa_loop_ivopts (void) tree_ssa_loop_ivopts (void)
{ {
if (!current_loops) if (number_of_loops () <= 1)
return 0; return 0;
tree_ssa_iv_optimize (); tree_ssa_iv_optimize ();
...@@ -547,9 +544,6 @@ struct tree_opt_pass pass_iv_optimize = ...@@ -547,9 +544,6 @@ struct tree_opt_pass pass_iv_optimize =
static unsigned int static unsigned int
tree_ssa_loop_done (void) tree_ssa_loop_done (void)
{ {
if (!current_loops)
return 0;
free_numbers_of_iterations_estimates (); free_numbers_of_iterations_estimates ();
scev_finalize (); scev_finalize ();
loop_optimizer_finalize (); loop_optimizer_finalize ();
......
...@@ -3801,7 +3801,7 @@ init_pre (bool do_fre) ...@@ -3801,7 +3801,7 @@ init_pre (bool do_fre)
/* Deallocate data structures used by PRE. */ /* Deallocate data structures used by PRE. */
static void static void
fini_pre (bool do_fre) fini_pre (void)
{ {
basic_block bb; basic_block bb;
unsigned int i; unsigned int i;
...@@ -3849,7 +3849,7 @@ fini_pre (bool do_fre) ...@@ -3849,7 +3849,7 @@ fini_pre (bool do_fre)
&& TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE) && TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
SSA_NAME_VALUE (name) = NULL; SSA_NAME_VALUE (name) = NULL;
} }
if (!do_fre && current_loops) if (current_loops != NULL)
loop_optimizer_finalize (); loop_optimizer_finalize ();
} }
...@@ -3915,7 +3915,7 @@ execute_pre (bool do_fre) ...@@ -3915,7 +3915,7 @@ execute_pre (bool do_fre)
realify_fake_stores (); realify_fake_stores ();
} }
fini_pre (do_fre); fini_pre ();
} }
/* Gate and execute functions for PRE. */ /* Gate and execute functions for PRE. */
......
...@@ -530,7 +530,7 @@ thread_block (basic_block bb, bool noloop_only) ...@@ -530,7 +530,7 @@ thread_block (basic_block bb, bool noloop_only)
/* If we thread the latch of the loop to its exit, the loop ceases to /* If we thread the latch of the loop to its exit, the loop ceases to
exist. Make sure we do not restrict ourselves in order to preserve exist. Make sure we do not restrict ourselves in order to preserve
this loop. */ this loop. */
if (current_loops && loop->header == bb) if (loop->header == bb)
{ {
e = loop_latch_edge (loop); e = loop_latch_edge (loop);
e2 = e->aux; e2 = e->aux;
...@@ -552,7 +552,6 @@ thread_block (basic_block bb, bool noloop_only) ...@@ -552,7 +552,6 @@ thread_block (basic_block bb, bool noloop_only)
/* If NOLOOP_ONLY is true, we only allow threading through the /* If NOLOOP_ONLY is true, we only allow threading through the
header of a loop to exit edges. */ header of a loop to exit edges. */
|| (noloop_only || (noloop_only
&& current_loops
&& bb == bb->loop_father->header && bb == bb->loop_father->header
&& !loop_exit_edge_p (bb->loop_father, e2))) && !loop_exit_edge_p (bb->loop_father, e2)))
{ {
...@@ -1023,6 +1022,9 @@ thread_through_all_blocks (bool may_peel_loop_headers) ...@@ -1023,6 +1022,9 @@ thread_through_all_blocks (bool may_peel_loop_headers)
struct loop *loop; struct loop *loop;
loop_iterator li; loop_iterator li;
/* We must know about loops in order to preserve them. */
gcc_assert (current_loops != NULL);
if (threaded_edges == NULL) if (threaded_edges == NULL)
return false; return false;
...@@ -1046,16 +1048,13 @@ thread_through_all_blocks (bool may_peel_loop_headers) ...@@ -1046,16 +1048,13 @@ thread_through_all_blocks (bool may_peel_loop_headers)
/* Then perform the threading through loop headers. We start with the /* Then perform the threading through loop headers. We start with the
innermost loop, so that the changes in cfg we perform won't affect innermost loop, so that the changes in cfg we perform won't affect
further threading. */ further threading. */
if (current_loops) FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
{ {
FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) if (!loop->header
{ || !bitmap_bit_p (threaded_blocks, loop->header->index))
if (!loop->header continue;
|| !bitmap_bit_p (threaded_blocks, loop->header->index))
continue;
retval |= thread_through_loop_header (loop, may_peel_loop_headers); retval |= thread_through_loop_header (loop, may_peel_loop_headers);
}
} }
if (retval) if (retval)
......
...@@ -5998,11 +5998,8 @@ static unsigned int ...@@ -5998,11 +5998,8 @@ static unsigned int
execute_vrp (void) execute_vrp (void)
{ {
loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS); loop_optimizer_init (LOOPS_NORMAL | LOOPS_HAVE_RECORDED_EXITS);
if (current_loops) rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
{ scev_initialize ();
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
scev_initialize ();
}
insert_range_assertions (); insert_range_assertions ();
...@@ -6023,11 +6020,8 @@ execute_vrp (void) ...@@ -6023,11 +6020,8 @@ execute_vrp (void)
update_ssa (TODO_update_ssa); update_ssa (TODO_update_ssa);
finalize_jump_threads (); finalize_jump_threads ();
if (current_loops) scev_finalize ();
{ loop_optimizer_finalize ();
scev_finalize ();
loop_optimizer_finalize ();
}
return 0; return 0;
} }
......
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