Add PROP_loops_normal_re_lcssa
---
gcc/loop-init.c | 13 +++++++++++++
gcc/tree-pass.h | 3 +++
gcc/tree-ssa-loop.c | 4 ++--
gcc/tree-vectorizer.c | 11 ++---------
4 files changed, 20 insertions(+), 11 deletions(-)
@@ -100,6 +100,10 @@ loop_optimizer_init (unsigned flags)
bool needs_fixup = loops_state_satisfies_p (LOOPS_NEED_FIXUP);
gcc_assert (cfun->curr_properties & PROP_loops);
+ if (cfun->curr_properties & PROP_loops_normal_re_lcssa)
+ gcc_assert (loops_state_satisfies_p (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS
+ | LOOP_CLOSED_SSA));
/* Ensure that the dominators are computed, like flow_loops_find does. */
calculate_dominance_info (CDI_DOMINATORS);
@@ -151,6 +155,15 @@ loop_optimizer_finalize (struct function *fn)
struct loop *loop;
basic_block bb;
+ if (fn->curr_properties & PROP_loops_normal_re_lcssa)
+ {
+ gcc_assert (loops_state_satisfies_p (fn, LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS
+ | LOOP_CLOSED_SSA));
+ gcc_assert (!loops_state_satisfies_p (fn, LOOPS_NEED_FIXUP));
+ return;
+ }
+
timevar_push (TV_LOOP_FINI);
if (loops_state_satisfies_p (fn, LOOPS_HAVE_RECORDED_EXITS))
@@ -228,6 +228,9 @@ protected:
current choices have
been optimized. */
#define PROP_scev (1 << 16) /* preserve scev info. */
+/* preserve loop structures in LOOPS_NORMAL with recorded exits, and in loop
+ closed ssa. */
+#define PROP_loops_normal_re_lcssa (1 << 17)
#define PROP_trees \
(PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
@@ -290,7 +290,7 @@ const pass_data pass_data_tree_loop_init =
OPTGROUP_LOOP, /* optinfo_flags */
TV_NONE, /* tv_id */
PROP_cfg, /* properties_required */
- PROP_scev, /* properties_provided */
+ PROP_loops_normal_re_lcssa | PROP_scev, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0, /* todo_flags_finish */
@@ -524,7 +524,7 @@ make_pass_iv_optimize (gcc::context *ctxt)
static unsigned int
tree_ssa_loop_done (void)
{
- cfun->curr_properties &= ~PROP_scev;
+ cfun->curr_properties &= ~(PROP_loops_normal_re_lcssa | PROP_scev);
free_numbers_of_iterations_estimates (cfun);
scev_finalize ();
loop_optimizer_finalize ();
@@ -727,11 +727,7 @@ pass_slp_vectorize::execute (function *fun)
{
basic_block bb;
- bool in_loop_pipeline = scev_initialized_p ();
- if (!in_loop_pipeline)
- {
- loop_optimizer_init (LOOPS_NORMAL);
- }
+ loop_optimizer_init (LOOPS_NORMAL);
scev_initialize ();
/* Mark all stmts as not belonging to the current region and unvisited. */
@@ -758,10 +754,7 @@ pass_slp_vectorize::execute (function *fun)
free_stmt_vec_info_vec ();
scev_finalize ();
- if (!in_loop_pipeline)
- {
- loop_optimizer_finalize ();
- }
+ loop_optimizer_finalize ();
return 0;
}