aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-10-13 07:02:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-10-13 07:02:55 +0000
commita68f286ccc36bc6d5e483383e490e2531307466b (patch)
tree680ab0c2d5a23c72aba53e272d03154fe7b9a7d8 /gcc/tree-data-ref.c
parent1163f058761b9d4b93d0ada5cdb5a6bd3cb2665c (diff)
downloadgcc-a68f286ccc36bc6d5e483383e490e2531307466b.zip
gcc-a68f286ccc36bc6d5e483383e490e2531307466b.tar.gz
gcc-a68f286ccc36bc6d5e483383e490e2531307466b.tar.bz2
re PR tree-optimization/82451 ([GRAPHITE] codegen error in get_rename_from_scev)
2017-10-13 Richard Biener <rguenther@suse.de> PR tree-optimization/82451 Revert 2017-10-02 Richard Biener <rguenther@suse.de> PR tree-optimization/82355 * graphite-isl-ast-to-gimple.c (build_iv_mapping): Also build a mapping for the enclosing loop but avoid generating one for the loop tree root. (copy_bb_and_scalar_dependences): Remove premature codegen error on PHIs in blocks duplicated into multiple places. * graphite-scop-detection.c (scop_detection::stmt_has_simple_data_refs_p): For a loop not in the region use it as loop and nest to analyze the DR in. (try_generate_gimple_bb): Likewise. * graphite-sese-to-poly.c (extract_affine_chrec): Adjust. (add_loop_constraints): For blocks in a loop not in the region create a dimension with a single iteration. * sese.h (gbb_loop_at_index): Remove assert. * cfgloop.c (loop_preheader_edge): For the loop tree root return the single successor of the entry block. * graphite-isl-ast-to-gimple.c (graphite_regenerate_ast_isl): Reset the SCEV hashtable and niters. * graphite-scop-detection.c (scop_detection::graphite_can_represent_scev): Add SCOP parameter, assert that we only have POLYNOMIAL_CHREC that vary in loops contained in the region. (scop_detection::graphite_can_represent_expr): Adjust. (scop_detection::stmt_has_simple_data_refs_p): For loops not in the region set loop to NULL. The nest is now the entry edge to the region. (try_generate_gimple_bb): Likewise. * sese.c (scalar_evolution_in_region): Adjust for instantiate_scev change. * tree-data-ref.h (graphite_find_data_references_in_stmt): Make nest parameter the edge into the region. (create_data_ref): Likewise. * tree-data-ref.c (dr_analyze_indices): Make nest parameter an entry edge into a region and adjust instantiate_scev calls. (create_data_ref): Likewise. (graphite_find_data_references_in_stmt): Likewise. (find_data_references_in_stmt): Pass the loop preheader edge from the nest argument. * tree-scalar-evolution.h (instantiate_scev): Make instantiate_below parameter the edge into the region. (instantiate_parameters): Use the loop preheader edge as entry. * tree-scalar-evolution.c (analyze_scalar_evolution): Handle NULL loop. (get_instantiated_value_entry): Make instantiate_below parameter the edge into the region. (instantiate_scev_name): Likewise. Adjust dominance checks, when we cannot use loop-based instantiation instantiate by walking use-def chains. (instantiate_scev_poly): Adjust. (instantiate_scev_binary): Likewise. (instantiate_scev_convert): Likewise. (instantiate_scev_not): Likewise. (instantiate_array_ref): Remove. (instantiate_scev_3): Likewise. (instantiate_scev_2): Likewise. (instantiate_scev_1): Likewise. (instantiate_scev_r): Do not blindly handle N-operand trees. Do not instantiate array-refs. Handle all constants and invariants. (instantiate_scev): Make instantiate_below parameter the edge into the region. (resolve_mixers): Use the loop preheader edge for the region parameter to instantiate_scev_r. * tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Adjust. * gcc.dg/graphite/pr82451.c: New testcase. * gfortran.dg/graphite/id-27.f90: Likewise. * gfortran.dg/graphite/pr82451.f: Likewise. From-SVN: r253707
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 19cceb8..559a8e4 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -957,15 +957,14 @@ access_fn_component_p (tree op)
}
/* Determines the base object and the list of indices of memory reference
- DR, analyzed in LOOP and instantiated in loop nest NEST. */
+ DR, analyzed in LOOP and instantiated before NEST. */
static void
-dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
+dr_analyze_indices (struct data_reference *dr, edge nest, loop_p loop)
{
vec<tree> access_fns = vNULL;
tree ref, op;
tree base, off, access_fn;
- basic_block before_loop;
/* If analyzing a basic-block there are no indices to analyze
and thus no access functions. */
@@ -977,7 +976,6 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
}
ref = DR_REF (dr);
- before_loop = block_before_loop (nest);
/* REALPART_EXPR and IMAGPART_EXPR can be handled like accesses
into a two element array with a constant index. The base is
@@ -1002,7 +1000,7 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
{
op = TREE_OPERAND (ref, 1);
access_fn = analyze_scalar_evolution (loop, op);
- access_fn = instantiate_scev (before_loop, loop, access_fn);
+ access_fn = instantiate_scev (nest, loop, access_fn);
access_fns.safe_push (access_fn);
}
else if (TREE_CODE (ref) == COMPONENT_REF
@@ -1034,7 +1032,7 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
{
op = TREE_OPERAND (ref, 0);
access_fn = analyze_scalar_evolution (loop, op);
- access_fn = instantiate_scev (before_loop, loop, access_fn);
+ access_fn = instantiate_scev (nest, loop, access_fn);
if (TREE_CODE (access_fn) == POLYNOMIAL_CHREC)
{
tree orig_type;
@@ -1139,7 +1137,7 @@ free_data_ref (data_reference_p dr)
in which the data reference should be analyzed. */
struct data_reference *
-create_data_ref (loop_p nest, loop_p loop, tree memref, gimple *stmt,
+create_data_ref (edge nest, loop_p loop, tree memref, gimple *stmt,
bool is_read, bool is_conditional_in_stmt)
{
struct data_reference *dr;
@@ -4970,7 +4968,8 @@ find_data_references_in_stmt (struct loop *nest, gimple *stmt,
FOR_EACH_VEC_ELT (references, i, ref)
{
- dr = create_data_ref (nest, loop_containing_stmt (stmt), ref->ref,
+ dr = create_data_ref (nest ? loop_preheader_edge (nest) : NULL,
+ loop_containing_stmt (stmt), ref->ref,
stmt, ref->is_read, ref->is_conditional_in_stmt);
gcc_assert (dr != NULL);
datarefs->safe_push (dr);
@@ -4986,7 +4985,7 @@ find_data_references_in_stmt (struct loop *nest, gimple *stmt,
should be analyzed. */
bool
-graphite_find_data_references_in_stmt (loop_p nest, loop_p loop, gimple *stmt,
+graphite_find_data_references_in_stmt (edge nest, loop_p loop, gimple *stmt,
vec<data_reference_p> *datarefs)
{
unsigned i;