Remove limit_scops
authorAditya Kumar <hiraditya@msn.com>
Tue, 8 Sep 2015 22:18:11 +0000 (22:18 +0000)
committerSebastian Pop <spop@gcc.gnu.org>
Tue, 8 Sep 2015 22:18:11 +0000 (22:18 +0000)
commit74032f471db79e96eb86a9f2ba43a36ca6c1ddcf
tree4ae633205ff90db31f378cc5d617287718e64532
parentb71a678232eca441b374221d2544404e41fbe572
Remove limit_scops

This patch removes graphite-scop-detection.c:limit_scops function and fix
related issues arising because of that. The functionality limit_scop was added
as an intermediate step to discard the loops which graphite could not
handle. Removing limit_scop required handling of different cases of loops and
surrounding code.  The scop is now larger so most test cases required 'number of
scops detected' to be fixed. By increasing the size of scop we can now optimize
loops which are 'siblings' of each other. This could enable loop fusion on a
number of loops. Since in the graphite framework we mostly want to opimize
loop-nests/adjacent-loops, we now discard scops with less than 2 loops. We
also discard scops without any data references.

Essentially:
 - Remove limite_scops.
 - Only select scops when there are at least two loops (loop nest or, side by side).
 - Discard loops without data-refs.
 - Fix test cases.

Passes bootstrap and reg-test.

gcc/ChangeLog:

2015-09-02  Aditya Kumar  <hiraditya@msn.com>
            Sebastian Pop  <s.pop@samsung.com>

        * graphite-isl-ast-to-gimple.c (gcc_expression_from_isl_ast_expr_id):
        Return the parameter if it was saved in corresponding
        parameter_rename_map of the region.
        (copy_def): Copy def from sese region to the newly created region.
        (copy_internal_parameters): Copy all the internal parameters defined
        within a region to the newly created region.
        (graphite_regenerate_ast_isl): Copy parameters to the new region before
        translating isl to gimple.
        * graphite-scop-detection.c (graphite_can_represent_loop): Bail out if
          the loop-nest does not have any data-references.
        (build_graphite_scops): Create a scop only when there is at least one
        loop inside it.
        (contains_only_close_phi_nodes): Deleted.
        (print_graphite_scop_statistics): Deleted
        (print_graphite_statistics): Deleted
        (limit_scops): Deleted.
        (build_scops): Removed call to limit_scops.
        * sese.c (new_sese): Construct.
        (free_sese): Destruct.
        (sese_add_exit_phis_edge): update_stmt after exit phi edge has been
        added.
        (set_rename): Pass sese region so that parameters inside the region can
        be added to its parameter_rename_map.
        (rename_uses): Pass sese region.
        (graphite_copy_stmts_from_block): Do not copy parameters that have been
        generated in the header of the scop. For each SSA_NAME in the
        parameter_rename_map rename its usage.
        (invariant_in_sese_p_rec): Return false if tree t is defined outside
        sese region.
        (scalar_evolution_in_region): If the tree t is invariant just return t.
        * sese.h: Added a parameter renamne map (parameter_rename_map_t) to
          struct sese to keep track of all the parameters which need renaming.
        * tree-data-ref.c (loop_nest_has_data_refs): Check if a loop nest has
          any data-refs.
        * tree-data-ref.h: Declaration of loop_nest_has_data_refs.

gcc/testsuite/ChangeLog:

2015-09-02  Aditya Kumar  <hiraditya@msn.com>
            Sebastian Pop  <s.pop@samsung.com>

        * gcc.dg/graphite/block-0.c: Modifed test case to match current output.
        * gcc.dg/graphite/block-1.c: Same.
        * gcc.dg/graphite/block-5.c: Same.
        * gcc.dg/graphite/block-6.c: Same.
        * gcc.dg/graphite/interchange-1.c: Same.
        * gcc.dg/graphite/interchange-10.c: Same.
        * gcc.dg/graphite/interchange-11.c: Same.
        * gcc.dg/graphite/interchange-13.c: Same.
        * gcc.dg/graphite/interchange-14.c: Same.
        * gcc.dg/graphite/interchange-3.c: Same.
        * gcc.dg/graphite/interchange-4.c: Same.
        * gcc.dg/graphite/interchange-7.c: Same.
        * gcc.dg/graphite/interchange-8.c: Same.
        * gcc.dg/graphite/interchange-9.c: Same.
        * gcc.dg/graphite/isl-codegen-loop-dumping.c: Same.
        * gcc.dg/graphite/pr35356-1.c (foo): Same.
        * gcc.dg/graphite/pr37485.c: Same.
        * gcc.dg/graphite/scop-0.c (int toto): Same.
        * gcc.dg/graphite/scop-1.c: Same.
        * gcc.dg/graphite/scop-10.c: Same.
        * gcc.dg/graphite/scop-11.c: Same.
        * gcc.dg/graphite/scop-12.c: Same.
        * gcc.dg/graphite/scop-13.c: Same.
        * gcc.dg/graphite/scop-16.c: Same.
        * gcc.dg/graphite/scop-17.c: Same.
        * gcc.dg/graphite/scop-18.c: Same.
        * gcc.dg/graphite/scop-2.c: Same.
        * gcc.dg/graphite/scop-21.c (int test): Same.
        * gcc.dg/graphite/scop-22.c (void foo): Same.
        * gcc.dg/graphite/scop-4.c: Same.
        * gcc.dg/graphite/scop-5.c: Same.
        * gcc.dg/graphite/scop-6.c: Same.
        * gcc.dg/graphite/scop-7.c: Same.
        * gcc.dg/graphite/scop-8.c: Same.
        * gcc.dg/graphite/scop-9.c: Same.
        * gcc.dg/graphite/scop-mvt.c (void mvt): Introduced dependency so that
          data-refs remain inside the inner loop.
        * gcc.dg/graphite/uns-block-1.c: Modifed test case to match o/p.
        * gcc.dg/graphite/uns-interchange-14.c: Same.
        * gcc.dg/graphite/uns-interchange-9.c: Same.
        * gfortran.dg/graphite/interchange-3.f90

libgomp/ChangeLog:

2015-09-04  Aditya Kumar  <hiraditya@msn.com>
            Sebastian Pop  <s.pop@samsung.com>

        * testsuite/libgomp.graphite/bounds.c (int foo): Modifed test case to
          match o/p.
        * testsuite/libgomp.graphite/force-parallel-1.c (void parloop): Same.
        * testsuite/libgomp.graphite/force-parallel-4.c: Same.
        * testsuite/libgomp.graphite/force-parallel-5.c: Same.
        * testsuite/libgomp.graphite/force-parallel-7.c: Same.
        * testsuite/libgomp.graphite/force-parallel-8.c: Same.

Co-Authored-By: Sebastian Pop <s.pop@samsung.com>
From-SVN: r227567
55 files changed:
gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/graphite-scop-detection.c
gcc/sese.c
gcc/sese.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/block-0.c
gcc/testsuite/gcc.dg/graphite/block-1.c
gcc/testsuite/gcc.dg/graphite/block-5.c
gcc/testsuite/gcc.dg/graphite/block-6.c
gcc/testsuite/gcc.dg/graphite/interchange-1.c
gcc/testsuite/gcc.dg/graphite/interchange-10.c
gcc/testsuite/gcc.dg/graphite/interchange-11.c
gcc/testsuite/gcc.dg/graphite/interchange-13.c
gcc/testsuite/gcc.dg/graphite/interchange-14.c
gcc/testsuite/gcc.dg/graphite/interchange-3.c
gcc/testsuite/gcc.dg/graphite/interchange-4.c
gcc/testsuite/gcc.dg/graphite/interchange-7.c
gcc/testsuite/gcc.dg/graphite/interchange-8.c
gcc/testsuite/gcc.dg/graphite/interchange-9.c
gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c
gcc/testsuite/gcc.dg/graphite/pr35356-1.c
gcc/testsuite/gcc.dg/graphite/pr37485.c
gcc/testsuite/gcc.dg/graphite/scop-0.c
gcc/testsuite/gcc.dg/graphite/scop-1.c
gcc/testsuite/gcc.dg/graphite/scop-10.c
gcc/testsuite/gcc.dg/graphite/scop-11.c
gcc/testsuite/gcc.dg/graphite/scop-12.c
gcc/testsuite/gcc.dg/graphite/scop-13.c
gcc/testsuite/gcc.dg/graphite/scop-16.c
gcc/testsuite/gcc.dg/graphite/scop-17.c
gcc/testsuite/gcc.dg/graphite/scop-18.c
gcc/testsuite/gcc.dg/graphite/scop-2.c
gcc/testsuite/gcc.dg/graphite/scop-21.c
gcc/testsuite/gcc.dg/graphite/scop-22.c
gcc/testsuite/gcc.dg/graphite/scop-4.c
gcc/testsuite/gcc.dg/graphite/scop-5.c
gcc/testsuite/gcc.dg/graphite/scop-6.c
gcc/testsuite/gcc.dg/graphite/scop-7.c
gcc/testsuite/gcc.dg/graphite/scop-8.c
gcc/testsuite/gcc.dg/graphite/scop-9.c
gcc/testsuite/gcc.dg/graphite/scop-mvt.c
gcc/testsuite/gcc.dg/graphite/uns-block-1.c
gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c
gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c
gcc/testsuite/gfortran.dg/graphite/interchange-3.f90
gcc/tree-data-ref.c
gcc/tree-data-ref.h
libgomp/ChangeLog
libgomp/testsuite/libgomp.graphite/bounds.c
libgomp/testsuite/libgomp.graphite/force-parallel-1.c
libgomp/testsuite/libgomp.graphite/force-parallel-4.c
libgomp/testsuite/libgomp.graphite/force-parallel-5.c
libgomp/testsuite/libgomp.graphite/force-parallel-7.c
libgomp/testsuite/libgomp.graphite/force-parallel-8.c