--- gcc/graphite-dependences.c | 298 ------------------------------------------- gcc/graphite-poly.c | 47 ------- gcc/graphite-poly.h | 9 -- gcc/graphite-sese-to-poly.c | 8 +- 4 files changed, 2 insertions(+), 360 deletions(-)
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index eb8d40f..02ed21f 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -567,162 +567,6 @@ free_poly_ddr (void *p) free (pddr); } -/* Return true when the data dependence relation between the data - references PDR1 belonging to PBB1 and PDR2 is part of a - reduction. */ - -static inline bool -reduction_dr_1 (poly_bb_p pbb1, poly_dr_p pdr1, poly_dr_p pdr2) -{ - int i; - poly_dr_p pdr; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr) - if (PDR_TYPE (pdr) == PDR_WRITE - && same_pdr_p (pdr, pdr1) && same_pdr_p (pdr, pdr2)) - return true; - - return false; -} - -/* Return true when the data dependence relation between the data - references PDR1 belonging to PBB1 and PDR2 belonging to PBB2 is - part of a reduction. */ - -static inline bool -reduction_dr_p (poly_dr_p pdr1, poly_dr_p pdr2) -{ - poly_bb_p pbb1 = PDR_PBB (pdr1); - poly_bb_p pbb2 = PDR_PBB (pdr2); - - if (PBB_IS_REDUCTION (pbb1)) - return reduction_dr_1 (pbb1, pdr1, pdr2); - - if (PBB_IS_REDUCTION (pbb2)) - return reduction_dr_1 (pbb2, pdr2, pdr1); - - return false; -} - -/* Returns true when the PBB_TRANSFORMED_SCATTERING functions of PBB1 - and PBB2 respect the data dependences of PBB_ORIGINAL_SCATTERING - functions. */ - -static bool -graphite_legal_transform_dr (poly_dr_p pdr1, poly_dr_p pdr2) -{ - ppl_Pointset_Powerset_C_Polyhedron_t po, pt; - graphite_dim_t ddim1, otdim1, otdim2, ttdim1, ttdim2; - ppl_Pointset_Powerset_C_Polyhedron_t po_temp; - ppl_dimension_type pdim; - bool is_empty_p; - poly_ddr_p opddr, tpddr; - poly_bb_p pbb1, pbb2; - - if (reduction_dr_p (pdr1, pdr2)) - return true; - - /* We build the reverse dependence relation for the transformed - scattering, such that when we intersect it with the original PO, - we get an empty intersection when the transform is legal: - i.e. the transform should reverse no dependences, and so PT, the - reversed transformed PDDR, should have no constraint from PO. */ - opddr = new_poly_ddr (pdr1, pdr2, 1, true); - - if (PDDR_KIND (opddr) == unknown_dependence) - return false; - - /* There are no dependences between PDR1 and PDR2 in the original - version of the program, or after the transform, so the - transform is legal. */ - if (pddr_is_empty (opddr)) - return true; - - tpddr = new_poly_ddr (pdr1, pdr2, -1, false); - - if (PDDR_KIND (tpddr) == unknown_dependence) - { - free_poly_ddr (tpddr); - return false; - } - - if (pddr_is_empty (tpddr)) - { - free_poly_ddr (tpddr); - return true; - } - - po = PDDR_DDP (opddr); - pt = PDDR_DDP (tpddr); - - /* Copy PO into PO_TEMP, such that PO is not destroyed. PO is - stored in a cache and should not be modified or freed. */ - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &pdim); - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&po_temp, - pdim, 0); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, po); - - /* Extend PO and PT to have the same dimensions. */ - pbb1 = PDR_PBB (pdr1); - pbb2 = PDR_PBB (pdr2); - ddim1 = pbb_dim_iter_domain (pbb1); - otdim1 = pbb_nb_scattering_orig (pbb1); - otdim2 = pbb_nb_scattering_orig (pbb2); - ttdim1 = pbb_nb_scattering_transform (pbb1); - ttdim2 = pbb_nb_scattering_transform (pbb2); - ppl_insert_dimensions_pointset (po_temp, otdim1, ttdim1); - ppl_insert_dimensions_pointset (po_temp, otdim1 + ttdim1 + ddim1 + otdim2, - ttdim2); - ppl_insert_dimensions_pointset (pt, 0, otdim1); - ppl_insert_dimensions_pointset (pt, otdim1 + ttdim1 + ddim1, otdim2); - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, pt); - is_empty_p = ppl_powerset_is_empty (po_temp); - - ppl_delete_Pointset_Powerset_C_Polyhedron (po_temp); - free_poly_ddr (tpddr); - - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\nloop carries dependency.\n"); - - return is_empty_p; -} - -/* Return true when the data dependence relation for PBB1 and PBB2 is - part of a reduction. */ - -static inline bool -reduction_ddr_p (poly_bb_p pbb1, poly_bb_p pbb2) -{ - return pbb1 == pbb2 && PBB_IS_REDUCTION (pbb1); -} - -/* Iterates over the data references of PBB1 and PBB2 and detect - whether the transformed schedule is correct. */ - -static bool -graphite_legal_transform_bb (poly_bb_p pbb1, poly_bb_p pbb2) -{ - int i, j; - poly_dr_p pdr1, pdr2; - - if (!PBB_PDR_DUPLICATES_REMOVED (pbb1)) - pbb_remove_duplicate_pdrs (pbb1); - - if (!PBB_PDR_DUPLICATES_REMOVED (pbb2)) - pbb_remove_duplicate_pdrs (pbb2); - - if (reduction_ddr_p (pbb1, pbb2)) - return true; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), j, pdr2) - if (!graphite_legal_transform_dr (pdr1, pdr2)) - return false; - - return true; -} - /* Add the constraints from the set S to the domain of MAP. */ static isl_map * @@ -874,8 +718,6 @@ no_violations (isl_union_map *schedule, isl_union_map *deps) bool graphite_legal_transform (scop_p scop) { - int i, j; - poly_bb_p pbb1, pbb2; int res; isl_union_map *transformed; @@ -900,16 +742,6 @@ graphite_legal_transform (scop_p scop) timevar_pop (TV_GRAPHITE_DATA_DEPS); return res; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - if (!graphite_legal_transform_bb (pbb1, pbb2)) - { - timevar_pop (TV_GRAPHITE_DATA_DEPS); - return false; - } - - return true; } /* Returns TRUE when the dependence polyhedron between PDR1 and @@ -977,134 +809,4 @@ dependency_between_pbbs_p (poly_bb_p pbb1, poly_bb_p pbb2, int level) return false; } -/* When ORIG is true, pretty print to FILE all the original data - dependences of SCoP in DOT format, otherwise print the transformed - data deps. */ - -static void -dot_deps_stmt_2 (FILE *file, scop_p scop, bool orig) -{ - int i, j, k, l; - poly_bb_p pbb1, pbb2; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - { - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2) - { - poly_ddr_p pddr = new_poly_ddr (pdr1, pdr2, 1, orig); - - if (!pddr_is_empty (pddr)) - { - fprintf (file, orig ? "OS%d -> OS%d\n" : "TS%d -> TS%d\n", - pbb_index (pbb1), pbb_index (pbb2)); - - free_poly_ddr (pddr); - goto done; - } - - free_poly_ddr (pddr); - } - done:; - } -} - -/* Pretty print to FILE all the data dependences of SCoP in DOT - format. */ - -static void -dot_deps_stmt_1 (FILE *file, scop_p scop) -{ - fputs ("digraph all {\n", file); - - dot_deps_stmt_2 (file, scop, true); - dot_deps_stmt_2 (file, scop, false); - - fputs ("}\n\n", file); -} - -/* When ORIG is true, pretty print to FILE all the original data - dependences of SCoP in DOT format, otherwise print the transformed - data deps. */ - -static void -dot_deps_2 (FILE *file, scop_p scop, bool orig) -{ - int i, j, k, l; - poly_bb_p pbb1, pbb2; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2) - { - poly_ddr_p pddr = new_poly_ddr (pdr1, pdr2, 1, orig); - - if (!pddr_is_empty (pddr)) - fprintf (file, orig - ? "OS%d_D%d -> OS%d_D%d\n" : "TS%d_D%d -> TS%d_D%d\n", - pbb_index (pbb1), PDR_ID (pdr1), - pbb_index (pbb2), PDR_ID (pdr2)); - - free_poly_ddr (pddr); - } -} - -/* Pretty print to FILE all the data dependences of SCoP in DOT - format. */ - -static void -dot_deps_1 (FILE *file, scop_p scop) -{ - fputs ("digraph all {\n", file); - - dot_deps_2 (file, scop, true); - dot_deps_2 (file, scop, false); - - fputs ("}\n\n", file); -} - -/* Display all the data dependences in SCoP using dotty. */ - -DEBUG_FUNCTION void -dot_deps (scop_p scop) -{ - /* When debugging, enable the following code. This cannot be used - in production compilers because it calls "system". */ -#if 0 - FILE *stream = fopen ("/tmp/scopdeps.dot", "w"); - gcc_assert (stream); - - dot_deps_1 (stream, scop); - fclose (stream); - - system ("dotty /tmp/scopdeps.dot &"); -#else - dot_deps_1 (stderr, scop); -#endif -} - -/* Display all the statement dependences in SCoP using dotty. */ - -DEBUG_FUNCTION void -dot_deps_stmt (scop_p scop) -{ - /* When debugging, enable the following code. This cannot be used - in production compilers because it calls "system". */ -#if 0 - FILE *stream = fopen ("/tmp/scopdeps.dot", "w"); - gcc_assert (stream); - - dot_deps_stmt_1 (stream, scop); - fclose (stream); - - system ("dotty /tmp/scopdeps.dot &"); -#else - dot_deps_stmt_1 (stderr, scop); -#endif -} - #endif diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 10e9fc0..36affb2 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -795,51 +795,6 @@ apply_poly_transforms (scop_p scop) return transform_done; } -/* Returns true when it PDR1 is a duplicate of PDR2: same PBB, and - their ACCESSES, TYPE, and NB_SUBSCRIPTS are the same. */ - -static inline bool -can_collapse_pdrs (poly_dr_p pdr1, poly_dr_p pdr2) -{ - bool res; - ppl_Pointset_Powerset_C_Polyhedron_t af1, af2, diff; - - if (PDR_PBB (pdr1) != PDR_PBB (pdr2) - || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2) - || PDR_TYPE (pdr1) != PDR_TYPE (pdr2)) - return false; - - af1 = PDR_ACCESSES (pdr1); - af2 = PDR_ACCESSES (pdr2); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&diff, af1); - ppl_Pointset_Powerset_C_Polyhedron_difference_assign (diff, af2); - - res = ppl_Pointset_Powerset_C_Polyhedron_is_empty (diff); - ppl_delete_Pointset_Powerset_C_Polyhedron (diff); - return res; -} - -/* Removes duplicated data references in PBB. */ - -void -pbb_remove_duplicate_pdrs (poly_bb_p pbb) -{ - int i, j; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr1) - for (j = i + 1; VEC_iterate (poly_dr_p, PBB_DRS (pbb), j, pdr2); j++) - if (can_collapse_pdrs (pdr1, pdr2)) - { - PDR_NB_REFS (pdr1) += PDR_NB_REFS (pdr2); - free_poly_dr (pdr2); - VEC_ordered_remove (poly_dr_p, PBB_DRS (pbb), j); - } - - PBB_PDR_DUPLICATES_REMOVED (pbb) = true; -} - /* Create a new polyhedral data reference and add it to PBB. It is defined by its ACCESSES, its TYPE, and the number of subscripts NB_SUBSCRIPTS. */ @@ -895,8 +850,6 @@ new_poly_bb (scop_p scop, void *black_box) PBB_SAVED (pbb) = NULL; PBB_ORIGINAL (pbb) = NULL; PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3); - PBB_IS_REDUCTION (pbb) = false; - PBB_PDR_DUPLICATES_REMOVED (pbb) = false; GBB_PBB ((gimple_bb_p) black_box) = pbb; return pbb; diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 5ae7fad..6381faf 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -373,12 +373,6 @@ struct poly_bb /* A copy of the transformed scattering. */ poly_scattering_p _saved; isl_map *saved; - - /* True when the PDR duplicates have already been removed. */ - bool pdr_duplicates_removed; - - /* True when this PBB contains only a reduction statement. */ - bool is_reduction; }; #define PBB_BLACK_BOX(PBB) ((gimple_bb_p) PBB->black_box) @@ -392,8 +386,6 @@ struct poly_bb #define PBB_SAVED(PBB) (PBB->_saved) #define PBB_NB_LOCAL_VARIABLES(PBB) (PBB_TRANSFORMED (PBB)->nb_local_variables) #define PBB_NB_SCATTERING_TRANSFORM(PBB) (PBB_TRANSFORMED (PBB)->nb_scattering) -#define PBB_PDR_DUPLICATES_REMOVED(PBB) (PBB->pdr_duplicates_removed) -#define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) extern poly_bb_p new_poly_bb (scop_p, void *); extern void free_poly_bb (poly_bb_p); @@ -422,7 +414,6 @@ extern int scop_do_strip_mine (scop_p, int); extern bool scop_do_block (scop_p); extern bool flatten_all_loops (scop_p); extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t); -extern void pbb_remove_duplicate_pdrs (poly_bb_p); /* Return the number of write data references in PBB. */ diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index bc1fd21..b1211ab 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -3304,9 +3304,7 @@ split_reduction_stmt (scop_p scop, gimple stmt) /* Do not split basic blocks with no writes to memory: the reduction will be the only write to memory. */ - if (nb_data_writes_in_bb (bb) == 0 - /* Or if we have already marked BB as a reduction. */ - || PBB_IS_REDUCTION (pbb_from_bb (bb))) + if (nb_data_writes_in_bb (bb) == 0) return bb; e1 = split_pbb (scop, pbb, bb, stmt); @@ -3737,9 +3735,7 @@ translate_scalar_reduction_to_array (scop_p scop, if (i == 0) { gimple stmt = loop_phi; - basic_block bb = split_reduction_stmt (scop, stmt); - poly_bb_p pbb = pbb_from_bb (bb); - PBB_IS_REDUCTION (pbb) = true; + split_reduction_stmt (scop, stmt); gcc_assert (close_phi == loop_phi); if (!red) -- 1.7.4.1