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
This commit is contained in:
Aditya Kumar 2015-09-08 22:18:11 +00:00 committed by Sebastian Pop
parent b71a678232
commit 74032f471d
55 changed files with 381 additions and 215 deletions

View file

@ -1,3 +1,42 @@
2015-09-08 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.
2015-09-08 Tom de Vries <tom@codesourcery.com>
* Makefile.in (generated_files): Add params.list.

View file

@ -57,7 +57,9 @@ extern "C" {
#include "tree-ssa-loop-manip.h"
#include "tree-scalar-evolution.h"
#include "gimple-ssa.h"
#include "tree-phinodes.h"
#include "tree-into-ssa.h"
#include "ssa-iterators.h"
#include <map>
#include "graphite-isl-ast-to-gimple.h"
@ -286,7 +288,12 @@ gcc_expression_from_isl_ast_expr_id (tree type,
gcc_assert (res != ip.end () &&
"Could not map isl_id to tree expression");
isl_ast_expr_free (expr_id);
return fold_convert (type, res->second);
tree t = res->second;
tree *val = region->parameter_rename_map->get(t);
if (!val)
val = &t;
return fold_convert (type, *val);
}
/* Converts an isl_ast_expr_int expression E to a GCC expression tree of
@ -1063,6 +1070,69 @@ scop_to_isl_ast (scop_p scop, ivs_params &ip)
return ast_isl;
}
/* Copy def from sese REGION to the newly created TO_REGION. TR is defined by
DEF_STMT. GSI points to entry basic block of the TO_REGION. */
static void
copy_def(tree tr, gimple def_stmt, sese region, sese to_region, gimple_stmt_iterator *gsi)
{
if (!defined_in_sese_p (tr, region))
return;
ssa_op_iter iter;
use_operand_p use_p;
FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE)
{
tree use_tr = USE_FROM_PTR (use_p);
/* Do not copy parameters that have been generated in the header of the
scop. */
if (region->parameter_rename_map->get(use_tr))
continue;
gimple def_of_use = SSA_NAME_DEF_STMT (use_tr);
if (!def_of_use)
continue;
copy_def (use_tr, def_of_use, region, to_region, gsi);
}
gimple copy = gimple_copy (def_stmt);
gsi_insert_after (gsi, copy, GSI_NEW_STMT);
/* Create new names for all the definitions created by COPY and
add replacement mappings for each new name. */
def_operand_p def_p;
ssa_op_iter op_iter;
FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_ALL_DEFS)
{
tree old_name = DEF_FROM_PTR (def_p);
tree new_name = create_new_def_for (old_name, copy, def_p);
region->parameter_rename_map->put(old_name, new_name);
}
update_stmt (copy);
}
static void
copy_internal_parameters(sese region, sese to_region)
{
/* For all the parameters which definitino is in the if_region->false_region,
insert code on true_region (if_region->true_region->entry). */
int i;
tree tr;
gimple_stmt_iterator gsi = gsi_start_bb(to_region->entry->dest);
FOR_EACH_VEC_ELT (region->params, i, tr)
{
// If def is not in region.
gimple def_stmt = SSA_NAME_DEF_STMT (tr);
if (def_stmt)
copy_def (tr, def_stmt, region, to_region, &gsi);
}
}
/* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for
the given SCOP. Return true if code generation succeeded.
@ -1102,10 +1172,13 @@ graphite_regenerate_ast_isl (scop_p scop)
context_loop = SESE_ENTRY (region)->src->loop_father;
translate_isl_ast_to_gimple t (region);
/* Copy all the parameters which are defined in the region. */
copy_internal_parameters(if_region->false_region, if_region->true_region);
t.translate_isl_ast (context_loop, root_node, if_region->true_region->entry,
ip);
translate_isl_ast_to_gimple t(region);
edge e = single_succ_edge (if_region->true_region->entry->dest);
split_edge (e);
t.translate_isl_ast (context_loop, root_node, e, ip);
mark_virtual_operands_for_renaming (cfun);
update_ssa (TODO_update_ssa);

View file

@ -472,6 +472,17 @@ graphite_can_represent_loop (basic_block scop_entry, loop_p loop)
tree niter;
struct tree_niter_desc niter_desc;
if (!loop_nest_has_data_refs (loop))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "[scop-detection-fail] ");
fprintf (dump_file, "Loop %d does not have any data reference.\n",
loop->num);
}
return false;
}
/* FIXME: For the moment, graphite cannot be used on loops that
iterate using induction variables that wrap. */
@ -1155,8 +1166,17 @@ build_graphite_scops (vec<sd_region> regions,
if (!exit)
continue;
scop = new_scop (new_sese (entry, exit));
scops->safe_push (scop);
sese sese_reg = new_sese (entry, exit);
scop = new_scop (sese_reg);
build_sese_loop_nests (sese_reg);
/* Scops with one or no loops are not interesting. */
if (SESE_LOOP_NEST (sese_reg).length () > 1)
scops->safe_push (scop);
else if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Discarded scop: %d loops\n",
SESE_LOOP_NEST (sese_reg).length ());
/* Are there overlapping SCoPs? */
#ifdef ENABLE_CHECKING
@ -1172,151 +1192,6 @@ build_graphite_scops (vec<sd_region> regions,
}
}
/* Returns true when BB contains only close phi nodes. */
static bool
contains_only_close_phi_nodes (basic_block bb)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
if (gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL)
return false;
return true;
}
/* Print statistics for SCOP to FILE. */
static void
print_graphite_scop_statistics (FILE* file, scop_p scop)
{
long n_bbs = 0;
long n_loops = 0;
long n_stmts = 0;
long n_conditions = 0;
long n_p_bbs = 0;
long n_p_loops = 0;
long n_p_stmts = 0;
long n_p_conditions = 0;
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
continue;
n_bbs++;
n_p_bbs += bb->count;
if (EDGE_COUNT (bb->succs) > 1)
{
n_conditions++;
n_p_conditions += bb->count;
}
for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
{
n_stmts++;
n_p_stmts += bb->count;
}
if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop)))
{
n_loops++;
n_p_loops += bb->count;
}
}
fprintf (file, "\nBefore limit_scops SCoP statistics (");
fprintf (file, "BBS:%ld, ", n_bbs);
fprintf (file, "LOOPS:%ld, ", n_loops);
fprintf (file, "CONDITIONS:%ld, ", n_conditions);
fprintf (file, "STMTS:%ld)\n", n_stmts);
fprintf (file, "\nBefore limit_scops SCoP profiling statistics (");
fprintf (file, "BBS:%ld, ", n_p_bbs);
fprintf (file, "LOOPS:%ld, ", n_p_loops);
fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
fprintf (file, "STMTS:%ld)\n", n_p_stmts);
}
/* Print statistics for SCOPS to FILE. */
static void
print_graphite_statistics (FILE* file, vec<scop_p> scops)
{
int i;
scop_p scop;
FOR_EACH_VEC_ELT (scops, i, scop)
print_graphite_scop_statistics (file, scop);
}
/* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
Example:
for (i |
{ |
for (j | SCoP 1
for (k |
} |
* SCoP frontier, as this line is not surrounded by any loop. *
for (l | SCoP 2
This is necessary as scalar evolution and parameter detection need a
outermost loop to initialize parameters correctly.
TODO: FIX scalar evolution and parameter detection to allow more flexible
SCoP frontiers. */
static void
limit_scops (vec<scop_p> *scops)
{
auto_vec<sd_region, 3> regions;
int i;
scop_p scop;
FOR_EACH_VEC_ELT (*scops, i, scop)
{
int j;
loop_p loop;
sese region = SCOP_REGION (scop);
build_sese_loop_nests (region);
FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), j, loop)
if (!loop_in_sese_p (loop_outer (loop), region)
&& single_exit (loop))
{
sd_region open_scop;
open_scop.entry = loop->header;
open_scop.exit = single_exit (loop)->dest;
/* This is a hack on top of the limit_scops hack. The
limit_scops hack should disappear all together. */
if (single_succ_p (open_scop.exit)
&& contains_only_close_phi_nodes (open_scop.exit))
open_scop.exit = single_succ_edge (open_scop.exit)->dest;
regions.safe_push (open_scop);
}
}
free_scops (*scops);
scops->create (3);
create_sese_edges (regions);
build_graphite_scops (regions, scops);
}
/* Returns true when P1 and P2 are close phis with the same
argument. */
@ -1501,10 +1376,6 @@ build_scops (vec<scop_p> *scops)
create_sese_edges (regions);
build_graphite_scops (regions, scops);
if (dump_file && (dump_flags & TDF_DETAILS))
print_graphite_statistics (dump_file, *scops);
limit_scops (scops);
regions.release ();
if (dump_file && (dump_flags & TDF_DETAILS))

View file

@ -267,6 +267,7 @@ new_sese (edge entry, edge exit)
SESE_LOOP_NEST (region).create (3);
SESE_ADD_PARAMS (region) = true;
SESE_PARAMS (region).create (3);
region->parameter_rename_map = new parameter_rename_map_t;
return region;
}
@ -281,6 +282,8 @@ free_sese (sese region)
SESE_PARAMS (region).release ();
SESE_LOOP_NEST (region).release ();
delete region->parameter_rename_map;
region->parameter_rename_map = NULL;
XDELETE (region);
}
@ -294,6 +297,7 @@ sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
create_new_def_for (use, phi, gimple_phi_result_ptr (phi));
add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION);
add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION);
update_stmt (phi);
}
/* Insert in the block BB phi nodes for variables defined in REGION
@ -373,12 +377,19 @@ get_rename (rename_map_type *rename_map, tree old_name)
/* Register in RENAME_MAP the rename tuple (OLD_NAME, EXPR). */
static void
set_rename (rename_map_type *rename_map, tree old_name, tree expr)
set_rename (rename_map_type *rename_map, tree old_name, tree expr, sese region)
{
if (old_name == expr)
return;
rename_map->put (old_name, expr);
tree t;
int i;
/* For a parameter of a scop we dont want to rename it. */
FOR_EACH_VEC_ELT (SESE_PARAMS (region), i, t)
if (old_name == t)
region->parameter_rename_map->put(old_name, expr);
}
/* Renames the scalar uses of the statement COPY, using the
@ -484,7 +495,7 @@ rename_uses (gimple copy, rename_map_type *rename_map,
recompute_tree_invariant_for_addr_expr (rhs);
}
set_rename (rename_map, old_name, new_expr);
set_rename (rename_map, old_name, new_expr, region);
}
return changed;
@ -525,6 +536,14 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
&& scev_analyzable_p (lhs, region))
continue;
/* Do not copy parameters that have been generated in the header of the
scop. */
if (is_gimple_assign (stmt)
&& (lhs = gimple_assign_lhs (stmt))
&& TREE_CODE (lhs) == SSA_NAME
&& region->parameter_rename_map->get(lhs))
continue;
/* Create a new copy of STMT and duplicate STMT's virtual
operands. */
copy = gimple_copy (stmt);
@ -539,7 +558,7 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
{
tree old_name = DEF_FROM_PTR (def_p);
tree new_name = create_new_def_for (old_name, copy, def_p);
set_rename (rename_map, old_name, new_name);
set_rename (rename_map, old_name, new_name, region);
}
if (rename_uses (copy, rename_map, &gsi_tgt, region, loop, iv_map,
@ -549,6 +568,25 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
fold_stmt_inplace (&gsi_tgt);
}
/* For each SSA_NAME in the parameter_rename_map rename their usage. */
ssa_op_iter iter;
use_operand_p use_p;
if (!is_gimple_debug (copy))
FOR_EACH_SSA_USE_OPERAND (use_p, copy, iter, SSA_OP_USE)
{
tree old_name = USE_FROM_PTR (use_p);
if (TREE_CODE (old_name) != SSA_NAME
|| SSA_NAME_IS_DEFAULT_DEF (old_name))
continue;
tree *new_expr = region->parameter_rename_map->get (old_name);
if (!new_expr)
continue;
replace_exp (use_p, *new_expr);
}
update_stmt (copy);
}
}
@ -722,6 +760,35 @@ set_ifsese_condition (ifsese if_region, tree condition)
gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
}
/* Return false if T is completely defined outside REGION. */
static bool
invariant_in_sese_p_rec (tree t, sese region)
{
ssa_op_iter iter;
use_operand_p use_p;
if (!defined_in_sese_p (t, region))
return true;
gimple stmt = SSA_NAME_DEF_STMT (t);
if (gimple_code (stmt) == GIMPLE_PHI
|| gimple_code (stmt) == GIMPLE_CALL)
return false;
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
{
tree use = USE_FROM_PTR (use_p);
if (!defined_in_sese_p (use, region))
continue;
if (!invariant_in_sese_p_rec (use, region))
return false;
}
return true;
}
/* Returns the scalar evolution of T in REGION. Every variable that
is not defined in the REGION is considered a parameter. */
@ -752,6 +819,9 @@ scalar_evolution_in_region (sese region, loop_p loop, tree t)
t = compute_overall_effect_of_inner_loop (def_loop, t);
return t;
}
else
return instantiate_scev (before, loop, t);
if (invariant_in_sese_p_rec (t, region))
return t;
return instantiate_scev (before, loop, t);
}

View file

@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_SESE_H
#define GCC_SESE_H
typedef hash_map<tree, tree> parameter_rename_map_t;
/* A Single Entry, Single Exit region is a part of the CFG delimited
by two edges. */
typedef struct sese_s
@ -32,6 +34,9 @@ typedef struct sese_s
/* Parameters used within the SCOP. */
vec<tree> params;
/* Parameters to be renamed. */
parameter_rename_map_t *parameter_rename_map;
/* Loops completely contained in the SCOP. */
bitmap loops;
vec<loop_p> loop_nest;

View file

@ -1,3 +1,48 @@
2015-09-08 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
2015-09-08 Alan Lawrence <alan.lawrence@arm.com>
PR target/63870

View file

@ -42,4 +42,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "not tiled" 3 "graphite" } } */
/* { dg-final { scan-tree-dump-times "not tiled" 2 "graphite" } } */

View file

@ -45,4 +45,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */

View file

@ -53,4 +53,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */

View file

@ -48,4 +48,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */

View file

@ -49,4 +49,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -46,4 +46,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */

View file

@ -46,4 +46,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -50,4 +50,4 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -54,4 +54,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 7 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */

View file

@ -47,4 +47,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -46,4 +46,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -46,4 +46,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -82,4 +82,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */

View file

@ -44,4 +44,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */

View file

@ -12,4 +12,6 @@ main (int n, int *a)
return 0;
}
/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \nfor \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\)\n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n S_4\\(c1, c3\\);" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \n\\{\n S_2\\();\n if \\(P_19 >= 1\\)\n
for \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\) \\{ \n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n
S_4\\(c1, c3\\); \n S_6\\(c1\\);\n \\} \n\\}" 1 "graphite"} } */

View file

@ -7,6 +7,10 @@ foo (int bar, int n, int k)
{
int i;
for (i = 0; i < n; i++)
if (i == k)
a[i] = bar;
for (i = 0; i < n; i++)
if (i == k)
a[i] = bar;

View file

@ -31,4 +31,4 @@ void fallbackSort ( UInt32* fmap,
AssertH ( j < 256, 1005 );
}
/* { dg-final { scan-tree-dump-times "tiled by" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */

View file

@ -9,7 +9,7 @@ int toto()
int b[100];
int N = foo ();
for (i = 0; i < 2*N+ 100; i++)
for (i = 0; i < N+ 100; i++)
for (j = 0; j < 200; j++)
a[j][i] = a[j+1][10] + 2;

View file

@ -27,4 +27,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -12,8 +12,6 @@ int toto()
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
bar ();
else
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
@ -27,4 +25,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -10,7 +10,6 @@ int toto()
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 3;
bar();
}
else
{
@ -28,4 +27,4 @@ int toto()
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -32,4 +32,4 @@ int toto()
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 5" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */

View file

@ -37,4 +37,4 @@ int toto()
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */

View file

@ -21,4 +21,4 @@ int test ()
foo (a[i][j]);
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -20,4 +20,4 @@ int test ()
foo (a[i][j]);
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -22,4 +22,4 @@ void test (void)
A[i][j] = B[i][k] * C[k][j];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -35,4 +35,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 4" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */

View file

@ -5,6 +5,9 @@ int test ()
int a[N+6];
int i;
for (i = 0; i < N; i++)
a[i] += 32;
for (i = 0; i < N; i++)
{
a[i] = i + 12;

View file

@ -6,6 +6,9 @@ void foo(int N, int *res)
double a, b;
double sum = 0.0;
for (i = 0; i < N; i++)
sum += u[i];
for (i = 0; i < N; i++)
{
a = u[i];

View file

@ -25,4 +25,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -9,6 +9,8 @@ int toto()
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
for (j = 2; j <= 23; j++)
a[j] = b + i;
b = 3;
bar();
}
@ -31,4 +33,4 @@ int toto()
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */

View file

@ -17,7 +17,6 @@ int toto()
{
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-1] + 2;
bar ();
}
for (k = 1; k < 100; k++)
@ -27,4 +26,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -13,7 +13,6 @@ int toto()
if (i * 2 == i + 8)
{
bar ();
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
}
@ -27,4 +26,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -14,8 +14,7 @@ int toto()
if (i * 2 == i + 8)
{
for (j = 1; j < 100; j++)
if (bar ())
b[i+j] = b[i+j-1] + 2;
b[i+j] = b[i+j-1] + 2;
}
else
a[i][i] = 2;
@ -27,4 +26,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -12,8 +12,6 @@ int toto()
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
bar ();
else
a[i][i] = 2;
for (k = 1; k < 100; k++)
@ -23,4 +21,4 @@ int toto()
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */

View file

@ -8,16 +8,16 @@ void mvt(long N) {
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x1[i] = x1[i] + a[i][j] * y_1[j];
x1[j] = x1[j] + a[i][j] * y_1[j];
}
}
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x2[i] = x2[i] + a[j][i] * y_2[j];
x2[j] = x2[j] + a[j][i] * y_2[j];
}
}
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */

View file

@ -45,4 +45,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */

View file

@ -55,4 +55,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */

View file

@ -45,4 +45,4 @@ main (void)
return 0;
}
/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */

View file

@ -24,4 +24,4 @@ Program FOO
end Program FOO
! { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } }
! { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } }

View file

@ -3927,6 +3927,49 @@ get_references_in_stmt (gimple stmt, vec<data_ref_loc, va_heap> *references)
return clobbers_memory;
}
/* Returns true if the loop-nest has any data reference. */
bool
loop_nest_has_data_refs (loop_p loop)
{
basic_block *bbs = get_loop_body (loop);
vec<data_ref_loc> references;
references.create (3);
for (unsigned i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
gimple_stmt_iterator bsi;
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
get_references_in_stmt (stmt, &references);
if (references.length ())
{
free (bbs);
references.release ();
return true;
}
}
}
free (bbs);
references.release ();
if (loop->inner)
{
loop = loop->inner;
while (loop)
{
if (loop_nest_has_data_refs (loop))
return true;
loop = loop->next;
}
}
return false;
}
/* Stores the data references in STMT to DATAREFS. If there is an unanalyzable
reference, returns false, otherwise returns true. NEST is the outermost
loop of the loop nest in which the references should be analyzed. */

View file

@ -322,6 +322,7 @@ extern bool find_data_references_in_stmt (struct loop *, gimple,
extern bool graphite_find_data_references_in_stmt (loop_p, loop_p, gimple,
vec<data_reference_p> *);
tree find_data_references_in_loop (struct loop *, vec<data_reference_p> *);
bool loop_nest_has_data_refs (loop_p loop);
struct data_reference *create_data_ref (loop_p, loop_p, tree, gimple, bool);
extern bool find_loop_nest (struct loop *, vec<loop_p> *);
extern struct data_dependence_relation *initialize_data_dependence_relation

View file

@ -1,3 +1,14 @@
2015-09-08 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.
2015-09-03 Jakub Jelinek <jakub@redhat.com>
* configure.tgt: Add missing ;; in between nvptx and rtems

View file

@ -3,6 +3,8 @@ int foo(int *a, int n)
int i;
for (i = 2; i < n; i++)
a[i] += a[i+1];
for (i = 2; i < n; i++)
a[i] += a[i+1];
}
/* Check that Graphite dependency checking notes the dependency. */

View file

@ -6,6 +6,9 @@ void parloop (int N)
{
int i;
for (i = 0; i < N; i++)
x[i] = i + 1;
for (i = 0; i < N; i++)
x[i] = i + 3;
@ -24,5 +27,5 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */
/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 8 "optimized" } } */

View file

@ -47,7 +47,6 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */

View file

@ -31,6 +31,6 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */

View file

@ -31,5 +31,5 @@ int main (void)
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */

View file

@ -43,8 +43,6 @@ int main(void)
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */
/* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */