On Thu, 19 Nov 2015, Tom de Vries wrote:
> On 16/11/15 13:45, Richard Biener wrote:
> > > I've eliminated all the uses for pass_tree_loop_init/pass_tree_loop_done
> > > in
> > > >the pass group. Instead, I've added conditional loop optimizer setup in:
> > > >- pass_lim and pass_scev_cprop (added in this patch), and
>
> Reposting the "Add pass_oacc_kernels pass group in passes.def" patch.
>
> pass_scev_cprop is no longer part of the pass group.
>
> And I've dropped the scev_initialize in pass_lim.
>
> Pass_lim is part of the pass_tree_loop pass group, where AFAIU scev info is
> initialized at the start of the pass group and updated or reset by passes in
> the pass group if necessary, such that it's always available, or can be
> recalculated on the spot.
>
> First, pass_lim doesn't invalidate scev info. And second, AFAIU pass_lim
> doesn't use scev info. So there doesn't seem to be a need to do anything about
> scev info for using pass_lim outside pass_tree_loop.
>
> > > >- pass_parallelize_loops_oacc_kernels (added in patch "Add
> > > > pass_parallelize_loops_oacc_kernels").
> > You miss calling scev_finalize ().
>
> I've added the scev_finalize () in patch "Add
> pass_parallelize_loops_oacc_kernels".
pass_lim::execute (function *fun)
{
+ if (!loops_state_satisfies_p (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS))
+ loop_optimizer_init (LOOPS_NORMAL
+ | LOOPS_HAVE_RECORDED_EXITS);
+
note that this will, when not in the loop pipeline, not properly
fixup loops if LOOPS_NEED_FIXUP is set (that doesn't clear other
loop flags). I'd rather make loop_optimizer_init do nothing
if requested flags are already set and no fixup is needed and
call the above unconditionally. Thus sth like
Index: gcc/loop-init.c
===================================================================
--- gcc/loop-init.c (revision 230649)
+++ gcc/loop-init.c (working copy)
@@ -103,7 +103,11 @@ loop_optimizer_init (unsigned flags)
calculate_dominance_info (CDI_DOMINATORS);
if (!needs_fixup)
- checking_verify_loop_structure ();
+ {
+ checking_verify_loop_structure ();
+ if (loops_state_satisfies_p (flags))
+ goto out;
+ }
/* Clear all flags. */
if (recorded_exits)
@@ -122,11 +126,12 @@ loop_optimizer_init (unsigned flags)
/* Apply flags to loops. */
apply_loop_flags (flags);
+ checking_verify_loop_structure ();
+
+out:
/* Dump loops. */
flow_loops_dump (dump_file, NULL, 1);
- checking_verify_loop_structure ();
-
timevar_pop (TV_LOOP_INIT);
}
if (number_of_loops (fun) <= 1)
return 0;
+ if (!loops_state_satisfies_p (LOOP_CLOSED_SSA))
+ rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+
return tree_ssa_lim ();
}
that looks bogus. The into-loop-closed SSA rewrite should be
only done if the state _satisfies_ it. I understand LIM doesn't
require loop-closed SSA. But it also doesn't destroy it obviously.
So just remove that.
> Thanks,
> - Tom
>
>
--
Richard Biener <[email protected]>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB
21284 (AG Nuernberg)