diff options
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 97 | ||||
-rw-r--r-- | gcc/tree-data-ref.h | 6 | ||||
-rw-r--r-- | gcc/tree-loop-distribution.c | 36 |
4 files changed, 76 insertions, 76 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b40dc28fb01..829d60a872e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2013-09-10 Richard Biener <rguenther@suse.de> + + * tree-data-ref.h (build_rdg): Drop all parameters but loop. + * tree-data-ref.c (create_rdg_vertices): Collect all data + references, signal failure to the caller, use data-ref API. + (build_rdg): Compute data references only once. Maintain + lifetime of data references and data dependences from within + RDG. + (free_rdg): Free dependence relations. + * tree-loop-distribution.c (rdg_flag_uses): Drop weird code + inventing extra dependences. + (distribute_loop): Update for RDG API changes. + 2013-09-10 Kai Tietz <ktietz@redhat.com> * doc/invoke.texi (fms-extensions): Document changed diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 5bd7719516b..ca2cd8b3ad0 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -5062,18 +5062,18 @@ create_rdg_edges (struct graph *rdg, vec<ddr_p> ddrs) create_rdg_edges_for_scalar (rdg, DEF_FROM_PTR (def_p), i); } -/* Build the vertices of the reduced dependence graph RDG. */ +/* Build the vertices of the reduced dependence graph RDG. Return false + if that failed. */ -static void -create_rdg_vertices (struct graph *rdg, vec<gimple> stmts, loop_p loop) +static bool +create_rdg_vertices (struct graph *rdg, vec<gimple> stmts, loop_p loop, + vec<data_reference_p> *datarefs) { - int i, j; + int i; gimple stmt; FOR_EACH_VEC_ELT (stmts, i, stmt) { - vec<data_ref_loc, va_stack> references; - data_ref_loc *ref; struct vertex *v = &(rdg->vertices[i]); /* Record statement to vertex mapping. */ @@ -5087,22 +5087,20 @@ create_rdg_vertices (struct graph *rdg, vec<gimple> stmts, loop_p loop) if (gimple_code (stmt) == GIMPLE_PHI) continue; - vec_stack_alloc (data_ref_loc, references, 2); - get_references_in_stmt (stmt, &references); - FOR_EACH_VEC_ELT (references, j, ref) + unsigned drp = datarefs->length (); + if (!find_data_references_in_stmt (loop, stmt, datarefs)) + return false; + for (unsigned j = drp; j < datarefs->length (); ++j) { - data_reference_p dr; - if (!ref->is_read) - RDGV_HAS_MEM_WRITE (v) = true; - else + data_reference_p dr = (*datarefs)[j]; + if (DR_IS_READ (dr)) RDGV_HAS_MEM_READS (v) = true; - dr = create_data_ref (loop, loop_containing_stmt (stmt), - *ref->pos, stmt, ref->is_read); - if (dr) - RDGV_DATAREFS (v).safe_push (dr); + else + RDGV_HAS_MEM_WRITE (v) = true; + RDGV_DATAREFS (v).safe_push (dr); } - references.release (); } + return true; } /* Initialize STMTS with all the statements of LOOP. When @@ -5168,25 +5166,46 @@ build_empty_rdg (int n_stmts) scalar dependence. */ struct graph * -build_rdg (struct loop *loop, - vec<loop_p> *loop_nest, - vec<ddr_p> *dependence_relations, - vec<data_reference_p> *datarefs) +build_rdg (struct loop *loop) { - struct graph *rdg = NULL; + struct graph *rdg; + vec<loop_p> loop_nest; + vec<gimple> stmts; + vec<data_reference_p> datarefs; + vec<ddr_p> dependence_relations; - if (compute_data_dependences_for_loop (loop, false, loop_nest, datarefs, - dependence_relations) - && known_dependences_p (*dependence_relations)) + loop_nest.create (3); + if (!find_loop_nest (loop, &loop_nest)) + { + loop_nest.release (); + return NULL; + } + + stmts.create (10); + stmts_from_loop (loop, &stmts); + rdg = build_empty_rdg (stmts.length ()); + datarefs.create (10); + if (!create_rdg_vertices (rdg, stmts, loop, &datarefs)) { - vec<gimple> stmts; - stmts.create (10); - stmts_from_loop (loop, &stmts); - rdg = build_empty_rdg (stmts.length ()); - create_rdg_vertices (rdg, stmts, loop); - create_rdg_edges (rdg, *dependence_relations); stmts.release (); + free_rdg (rdg); + return NULL; + } + stmts.release (); + dependence_relations.create (100); + if (!compute_all_dependences (datarefs, &dependence_relations, loop_nest, + false) + || !known_dependences_p (dependence_relations)) + { + loop_nest.release (); + datarefs.release (); + dependence_relations.release (); + free_rdg (rdg); + return NULL; } + loop_nest.release (); + create_rdg_edges (rdg, dependence_relations); + dependence_relations.release (); return rdg; } @@ -5204,11 +5223,17 @@ free_rdg (struct graph *rdg) struct graph_edge *e; for (e = v->succ; e; e = e->succ_next) - free (e->data); + { + free_dependence_relation (RDGE_RELATION (e)); + free (e->data); + } - gimple_set_uid (RDGV_STMT (v), -1); - free_data_refs (RDGV_DATAREFS (v)); - free (v->data); + if (v->data) + { + gimple_set_uid (RDGV_STMT (v), -1); + free_data_refs (RDGV_DATAREFS (v)); + free (v->data); + } } free_graph (rdg); diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 27737262b1f..2bc2adba5e1 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -585,11 +585,7 @@ typedef struct rdg_edge #define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level #define RDGE_RELATION(E) ((struct rdg_edge *) ((E)->data))->relation -struct graph *build_rdg (struct loop *, - vec<loop_p> *, - vec<ddr_p> *, - vec<data_reference_p> *); -struct graph *build_empty_rdg (int); +struct graph *build_rdg (struct loop *); void free_rdg (struct graph *); /* Return the index of the variable VAR in the LOOP_NEST array. */ diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 95c4d5f753a..707a4b28127 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -635,7 +635,6 @@ static void rdg_flag_uses (struct graph *rdg, int u, partition_t partition, bitmap loops, bitmap processed) { - use_operand_p use_p; struct vertex *x = &(rdg->vertices[u]); gimple stmt = RDGV_STMT (x); struct graph_edge *anti_dep = has_anti_or_output_dependence (x); @@ -652,26 +651,6 @@ rdg_flag_uses (struct graph *rdg, int u, partition_t partition, bitmap loops, processed); } - if (gimple_code (stmt) != GIMPLE_PHI) - { - if ((use_p = gimple_vuse_op (stmt)) != NULL_USE_OPERAND_P) - { - tree use = USE_FROM_PTR (use_p); - - if (TREE_CODE (use) == SSA_NAME - && !SSA_NAME_IS_DEFAULT_DEF (use)) - { - gimple def_stmt = SSA_NAME_DEF_STMT (use); - int v = rdg_vertex_for_stmt (rdg, def_stmt); - - if (v >= 0 - && !already_processed_vertex_p (processed, v)) - rdg_flag_vertex_and_dependent (rdg, v, partition, loops, - processed); - } - } - } - if (is_gimple_assign (stmt) && has_upstream_mem_writes (u)) { tree op0 = gimple_assign_lhs (stmt); @@ -1438,15 +1417,8 @@ distribute_loop (struct loop *loop, vec<gimple> stmts) gimple s; unsigned i; vec<int> vertices; - vec<ddr_p> dependence_relations; - vec<data_reference_p> datarefs; - vec<loop_p> loop_nest; - - datarefs.create (10); - dependence_relations.create (100); - loop_nest.create (3); - rdg = build_rdg (loop, &loop_nest, &dependence_relations, &datarefs); + rdg = build_rdg (loop); if (!rdg) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -1454,9 +1426,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts) "FIXME: Loop %d not distributed: failed to build the RDG.\n", loop->num); - free_dependence_relations (dependence_relations); - free_data_refs (datarefs); - loop_nest.release (); return res; } @@ -1482,9 +1451,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts) res = ldist_gen (loop, rdg, vertices); vertices.release (); free_rdg (rdg); - free_dependence_relations (dependence_relations); - free_data_refs (datarefs); - loop_nest.release (); return res; } |