On Tue, 26 Sep 2017, Sebastian Pop wrote:

> On Tue, Sep 26, 2017 at 7:03 AM, Richard Biener <rguent...@suse.de> wrote:
> 
> >
> > The following is the result of me trying to understand SCOP detection
> > and the validity checks spread around the machinery.  It removes several
> > quadraticnesses by folding validity checks into
> > scop_detection::harmful_loop_in_region where we already walk over all
> > BBs in the region and process individual found loops.
> >
> > It also rewrites build_scop_depth/build_scop_breadth into something
> > I can undestand.
> >
> > Bootstrap and regtest is running on x86_64-unknown-linux-gnu (graphite.exp
> > for all langs is happy, so is SPEC CPU 2006 testing where the statistics
> > agree before/after the patch).
> >
> > I'll apply this after the bootstrap finished.
> >
> 
> Have you tried to bootstrap with BOOT_CFLAGS="-O2 -fgraphite-identity"?

I do "-O2 -g -floop-nest-optimize" but I guess -fgraphite-identity
should catch more issues?  Hmm, maybe -floop-nest-optimize and
-fgraphite-identity should be combinable

Index: gcc/graphite-optimize-isl.c
===================================================================
--- gcc/graphite-optimize-isl.c (revision 253203)
+++ gcc/graphite-optimize-isl.c (working copy)
@@ -189,7 +189,7 @@ optimize_isl (scop_p scop)
        print_schedule_ast (dump_file, scop->original_schedule, scop);
       isl_schedule_free (scop->transformed_schedule);
       scop->transformed_schedule = isl_schedule_copy 
(scop->original_schedule);
-      return false;
+      return flag_graphite_identity || flag_loop_parallelize_all;
     }
 
   return true;

I'll test/commit the above.

> 
> > Richard.
> >
> > 2017-09-26  Richard Biener  <rguent...@suse.de>
> >
> >         * graphite-scop-detection.c (scop_detection::build_scop_depth):
> > Rewrite,
> >         fold in ...
> >         (scop_detection::build_scop_breadth): ... this.  Removed.
> >         (scop_detection::loop_is_valid_in_scop): Fold into single caller.
> >         (scop_detection::harmful_stmt_in_bb): Likewise.
> >         (scop_detection::graphite_can_represent_stmt): Likewise.
> >         (scop_detection::loop_body_is_valid_scop): Likewise.  Remove
> > recursion.
> >         (scop_detection::can_represent_loop): Remove recursion, fold in
> > ...
> >         (scop_detection::can_represent_loop_1): ... this.  Removed.
> >         (scop_detection::harmful_loop_in_region): Simplify after inlining
> >         the above and remove more quadraticness.
> >         (build_scops): Adjust.
> >         * tree-data-ref.c (loop_nest_has_data_refs): Remove pointless
> >         quadraticness.
> >
> >
> This goes in the right direction: it cuts down compilation time.
> As it is not a trivial change, I need some time to understand how
> the scop detection works with this change.

The only functional change should be that the SESE composition now
works top-down instead of working its way bottom-up.  It's not clear
whether we do more or less work that way but at least the function
is now readable -- I think we can structure it bottom-up as well
without doing the confusing two-function way (which I believe
did quite some duplicate work but I never was sure...).

Richard.

Reply via email to