+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.
#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"
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
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.
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);
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. */
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
}
}
-/* 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. */
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))
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;
}
SESE_PARAMS (region).release ();
SESE_LOOP_NEST (region).release ();
+ delete region->parameter_rename_map;
+ region->parameter_rename_map = NULL;
XDELETE (region);
}
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
/* 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
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;
&& 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);
{
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,
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);
}
}
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. */
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);
}
#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
/* 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;
+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
return 0;
}
-/* { dg-final { scan-tree-dump-times "not tiled" 3 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "not tiled" 2 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 7 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
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"} } */
{
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;
AssertH ( j < 256, 1005 );
}
-/* { dg-final { scan-tree-dump-times "tiled by" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
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;
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"} } */
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;
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"} } */
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 3;
- bar();
}
else
{
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"} } */
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"} } */
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"} } */
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"} } */
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"} } */
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"} } */
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"} } */
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;
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];
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"} } */
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
+ for (j = 2; j <= 23; j++)
+ a[j] = b + i;
b = 3;
bar();
}
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"} } */
{
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-1] + 2;
- bar ();
}
for (k = 1; k < 100; k++)
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"} } */
if (i * 2 == i + 8)
{
- bar ();
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
}
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"} } */
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;
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"} } */
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++)
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"} } */
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" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */
return 0;
}
-/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */
end Program FOO
-! { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } }
+! { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } }
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. */
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
+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
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. */
{
int i;
+ for (i = 0; i < N; i++)
+ x[i] = i + 1;
+
for (i = 0; i < N; i++)
x[i] = i + 3;
}
/* 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" } } */
}
/* 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" } } */
}
/* 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" } } */
}
/* 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" } } */
}
/* 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" } } */