Commit efa21390 by Sebastian Pop Committed by Sebastian Pop

Postpone the rewrite out of SSA to the end of the translation to polyhedral representation.

2010-11-22  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/45297
	* graphite-poly.c (new_poly_bb): Returns a poly_bb_p.  Do not take
	the reduction bool in parameter.  Clear PBB_IS_REDUCTION.  Set GBB_PBB.
	* graphite-poly.h (new_poly_bb): Update declaration.
	(gbb_from_bb): Moved here...
	(pbb_from_bb): New.
	* graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node):
	Removed.
	(graphite_stmt_p): Removed.
	(try_generate_gimple_bb): Returns a gimple_bb_p.  Do not pass in
	sbitmap reductions.  Always build a gimple_bb_p.  Do not call
	new_poly_bb.
	(build_scop_bbs_1): Do not pass in sbitmap reductions.
	(build_scop_bbs): Same.
	(gbb_from_bb): ... from here.
	(add_conditions_to_constraints): Moved up.
	(analyze_drs): New.
	(build_scop_drs): Call analyze_drs.  Remove all the PBBs that do
	not contain data references.
	(new_pbb_from_pbb): New.
	(insert_out_of_ssa_copy_on_edge): Call new_pbb_from_pbb after a
	block is split.
	(rewrite_close_phi_out_of_ssa): Update call to
	insert_out_of_ssa_copy_on_edge.
	(rewrite_reductions_out_of_ssa): Now static.
	(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
	(split_pbb): New.
	(split_reduction_stmt): Call split_pbb.
	(translate_scalar_reduction_to_array): Pass in the scop, do not
	pass in the sbitmap reductions.
	(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
	(rewrite_commutative_reductions_out_of_ssa_loop): Same.
	(rewrite_commutative_reductions_out_of_ssa): Same.
	(build_poly_scop): Call build_scop_bbs,
	rewrite_commutative_reductions_out_of_ssa,
	rewrite_reductions_out_of_ssa, and
	rewrite_cross_bb_scalar_deps_out_of_ssa.  Move build_scop_drs
	before scop_to_lst.
	* graphite-sese-to-poly.h (rewrite_commutative_reductions_out_of_ssa):
	Removed declaration.
	(rewrite_reductions_out_of_ssa): Same.
	(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
	(build_scop_bbs): Same.
	* graphite.c (graphite_transform_loops): Do not initialize reductions.
	Do not call build_scop_bbs,
	rewrite_commutative_reductions_out_of_ssa,
	rewrite_reductions_out_of_ssa, and
	rewrite_cross_bb_scalar_deps_out_of_ssa.
	* sese.h (struct gimple_bb): Add field pbb.
	(GBB_PBB): New.

	* gcc.dg/graphite/pr45297.c: New.

From-SVN: r167348
parent 70a2ae0f
2010-12-01 Sebastian Pop <sebastian.pop@amd.com> 2010-12-01 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/45297
* graphite-poly.c (new_poly_bb): Returns a poly_bb_p. Do not take
the reduction bool in parameter. Clear PBB_IS_REDUCTION. Set GBB_PBB.
* graphite-poly.h (new_poly_bb): Update declaration.
(gbb_from_bb): Moved here...
(pbb_from_bb): New.
* graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node):
Removed.
(graphite_stmt_p): Removed.
(try_generate_gimple_bb): Returns a gimple_bb_p. Do not pass in
sbitmap reductions. Always build a gimple_bb_p. Do not call
new_poly_bb.
(build_scop_bbs_1): Do not pass in sbitmap reductions.
(build_scop_bbs): Same.
(gbb_from_bb): ... from here.
(add_conditions_to_constraints): Moved up.
(analyze_drs): New.
(build_scop_drs): Call analyze_drs. Remove all the PBBs that do
not contain data references.
(new_pbb_from_pbb): New.
(insert_out_of_ssa_copy_on_edge): Call new_pbb_from_pbb after a
block is split.
(rewrite_close_phi_out_of_ssa): Update call to
insert_out_of_ssa_copy_on_edge.
(rewrite_reductions_out_of_ssa): Now static.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
(split_pbb): New.
(split_reduction_stmt): Call split_pbb.
(translate_scalar_reduction_to_array): Pass in the scop, do not
pass in the sbitmap reductions.
(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
(build_poly_scop): Call build_scop_bbs,
rewrite_commutative_reductions_out_of_ssa,
rewrite_reductions_out_of_ssa, and
rewrite_cross_bb_scalar_deps_out_of_ssa. Move build_scop_drs
before scop_to_lst.
* graphite-sese-to-poly.h (rewrite_commutative_reductions_out_of_ssa):
Removed declaration.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
(build_scop_bbs): Same.
* graphite.c (graphite_transform_loops): Do not initialize reductions.
Do not call build_scop_bbs,
rewrite_commutative_reductions_out_of_ssa,
rewrite_reductions_out_of_ssa, and
rewrite_cross_bb_scalar_deps_out_of_ssa.
* sese.h (struct gimple_bb): Add field pbb.
(GBB_PBB): New.
2010-12-01 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits): * graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits):
New. New.
(rewrite_cross_bb_scalar_deps): Pass in the scop. Call (rewrite_cross_bb_scalar_deps): Pass in the scop. Call
2010-11-22 Sebastian Pop <sebastian.pop@amd.com> 2010-11-22 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/45297
* graphite-poly.c (new_poly_bb): Returns a poly_bb_p. Do not take
the reduction bool in parameter. Clear PBB_IS_REDUCTION. Set GBB_PBB.
* graphite-poly.h (new_poly_bb): Update declaration.
(gbb_from_bb): Moved here...
(pbb_from_bb): New.
* graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node):
Removed.
(graphite_stmt_p): Removed.
(try_generate_gimple_bb): Returns a gimple_bb_p. Do not pass in
sbitmap reductions. Always build a gimple_bb_p. Do not call
new_poly_bb.
(build_scop_bbs_1): Do not pass in sbitmap reductions.
(build_scop_bbs): Same.
(gbb_from_bb): ... from here.
(add_conditions_to_constraints): Moved up.
(analyze_drs): New.
(build_scop_drs): Call analyze_drs. Remove all the PBBs that do
not contain data references.
(new_pbb_from_pbb): New.
(insert_out_of_ssa_copy_on_edge): Call new_pbb_from_pbb after a
block is split.
(rewrite_close_phi_out_of_ssa): Update call to
insert_out_of_ssa_copy_on_edge.
(rewrite_reductions_out_of_ssa): Now static.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
(split_pbb): New.
(split_reduction_stmt): Call split_pbb.
(translate_scalar_reduction_to_array): Pass in the scop, do not
pass in the sbitmap reductions.
(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
(build_poly_scop): Call build_scop_bbs,
rewrite_commutative_reductions_out_of_ssa,
rewrite_reductions_out_of_ssa, and
rewrite_cross_bb_scalar_deps_out_of_ssa. Move build_scop_drs
before scop_to_lst.
* graphite-sese-to-poly.h (rewrite_commutative_reductions_out_of_ssa):
Removed declaration.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Same.
(build_scop_bbs): Same.
* graphite.c (graphite_transform_loops): Do not initialize reductions.
Do not call build_scop_bbs,
rewrite_commutative_reductions_out_of_ssa,
rewrite_reductions_out_of_ssa, and
rewrite_cross_bb_scalar_deps_out_of_ssa.
* sese.h (struct gimple_bb): Add field pbb.
(GBB_PBB): New.
* gcc.dg/graphite/pr45297.c: New.
2010-11-22 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits): * graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits):
New. New.
(rewrite_cross_bb_scalar_deps): Pass in the scop. Call (rewrite_cross_bb_scalar_deps): Pass in the scop. Call
......
...@@ -874,8 +874,8 @@ free_poly_dr (poly_dr_p pdr) ...@@ -874,8 +874,8 @@ free_poly_dr (poly_dr_p pdr)
/* Create a new polyhedral black box. */ /* Create a new polyhedral black box. */
void poly_bb_p
new_poly_bb (scop_p scop, void *black_box, bool reduction) new_poly_bb (scop_p scop, void *black_box)
{ {
poly_bb_p pbb = XNEW (struct poly_bb); poly_bb_p pbb = XNEW (struct poly_bb);
...@@ -886,9 +886,11 @@ new_poly_bb (scop_p scop, void *black_box, bool reduction) ...@@ -886,9 +886,11 @@ new_poly_bb (scop_p scop, void *black_box, bool reduction)
PBB_SAVED (pbb) = NULL; PBB_SAVED (pbb) = NULL;
PBB_ORIGINAL (pbb) = NULL; PBB_ORIGINAL (pbb) = NULL;
PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3); PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3);
PBB_IS_REDUCTION (pbb) = reduction; PBB_IS_REDUCTION (pbb) = false;
PBB_PDR_DUPLICATES_REMOVED (pbb) = false; PBB_PDR_DUPLICATES_REMOVED (pbb) = false;
VEC_safe_push (poly_bb_p, heap, SCOP_BBS (scop), pbb); GBB_PBB ((gimple_bb_p) black_box) = pbb;
return pbb;
} }
/* Free polyhedral black box. */ /* Free polyhedral black box. */
......
...@@ -389,7 +389,7 @@ struct poly_bb ...@@ -389,7 +389,7 @@ struct poly_bb
#define PBB_PDR_DUPLICATES_REMOVED(PBB) (PBB->pdr_duplicates_removed) #define PBB_PDR_DUPLICATES_REMOVED(PBB) (PBB->pdr_duplicates_removed)
#define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction)
extern void new_poly_bb (scop_p, void *, bool); extern poly_bb_p new_poly_bb (scop_p, void *);
extern void free_poly_bb (poly_bb_p); extern void free_poly_bb (poly_bb_p);
extern void debug_loop_vec (poly_bb_p); extern void debug_loop_vec (poly_bb_p);
extern void schedule_to_scattering (poly_bb_p, int); extern void schedule_to_scattering (poly_bb_p, int);
...@@ -434,6 +434,22 @@ number_of_write_pdrs (poly_bb_p pbb) ...@@ -434,6 +434,22 @@ number_of_write_pdrs (poly_bb_p pbb)
return res; return res;
} }
/* Returns a gimple_bb from BB. */
static inline gimple_bb_p
gbb_from_bb (basic_block bb)
{
return (gimple_bb_p) bb->aux;
}
/* The poly_bb of the BB. */
static inline poly_bb_p
pbb_from_bb (basic_block bb)
{
return GBB_PBB (gbb_from_bb (bb));
}
/* The basic block of the PBB. */ /* The basic block of the PBB. */
static inline basic_block static inline basic_block
......
...@@ -29,9 +29,5 @@ struct base_alias_pair ...@@ -29,9 +29,5 @@ struct base_alias_pair
}; };
void build_poly_scop (scop_p); void build_poly_scop (scop_p);
void rewrite_commutative_reductions_out_of_ssa (sese, sbitmap);
void rewrite_reductions_out_of_ssa (scop_p);
void rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p);
void build_scop_bbs (scop_p, sbitmap);
#endif #endif
...@@ -262,7 +262,6 @@ graphite_transform_loops (void) ...@@ -262,7 +262,6 @@ graphite_transform_loops (void)
bool need_cfg_cleanup_p = false; bool need_cfg_cleanup_p = false;
VEC (scop_p, heap) *scops = NULL; VEC (scop_p, heap) *scops = NULL;
htab_t bb_pbb_mapping; htab_t bb_pbb_mapping;
sbitmap reductions;
if (!graphite_initialize ()) if (!graphite_initialize ())
return; return;
...@@ -276,33 +275,17 @@ graphite_transform_loops (void) ...@@ -276,33 +275,17 @@ graphite_transform_loops (void)
} }
bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free); bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
reductions = sbitmap_alloc (last_basic_block * 2);
sbitmap_zero (reductions);
FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (dbg_cnt (graphite_scop))
rewrite_commutative_reductions_out_of_ssa (SCOP_REGION (scop),
reductions);
FOR_EACH_VEC_ELT (scop_p, scops, i, scop) FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
if (dbg_cnt (graphite_scop)) if (dbg_cnt (graphite_scop))
{ {
rewrite_reductions_out_of_ssa (scop); build_poly_scop (scop);
rewrite_cross_bb_scalar_deps_out_of_ssa (scop);
build_scop_bbs (scop, reductions);
}
sbitmap_free (reductions);
FOR_EACH_VEC_ELT (scop_p, scops, i, scop) if (POLY_SCOP_P (scop)
if (dbg_cnt (graphite_scop)) && apply_poly_transforms (scop)
build_poly_scop (scop); && gloog (scop, bb_pbb_mapping))
need_cfg_cleanup_p = true;
FOR_EACH_VEC_ELT (scop_p, scops, i, scop) }
if (POLY_SCOP_P (scop)
&& apply_poly_transforms (scop)
&& gloog (scop, bb_pbb_mapping))
need_cfg_cleanup_p = true;
htab_delete (bb_pbb_mapping); htab_delete (bb_pbb_mapping);
free_scops (scops); free_scops (scops);
......
...@@ -312,6 +312,7 @@ recompute_all_dominators (void) ...@@ -312,6 +312,7 @@ recompute_all_dominators (void)
typedef struct gimple_bb typedef struct gimple_bb
{ {
basic_block bb; basic_block bb;
struct poly_bb *pbb;
/* Lists containing the restrictions of the conditional statements /* Lists containing the restrictions of the conditional statements
dominating this bb. This bb can only be executed, if all conditions dominating this bb. This bb can only be executed, if all conditions
...@@ -338,10 +339,11 @@ typedef struct gimple_bb ...@@ -338,10 +339,11 @@ typedef struct gimple_bb
VEC (data_reference_p, heap) *data_refs; VEC (data_reference_p, heap) *data_refs;
} *gimple_bb_p; } *gimple_bb_p;
#define GBB_BB(GBB) GBB->bb #define GBB_BB(GBB) (GBB)->bb
#define GBB_DATA_REFS(GBB) GBB->data_refs #define GBB_PBB(GBB) (GBB)->pbb
#define GBB_CONDITIONS(GBB) GBB->conditions #define GBB_DATA_REFS(GBB) (GBB)->data_refs
#define GBB_CONDITION_CASES(GBB) GBB->condition_cases #define GBB_CONDITIONS(GBB) (GBB)->conditions
#define GBB_CONDITION_CASES(GBB) (GBB)->condition_cases
/* Return the innermost loop that contains the basic block GBB. */ /* Return the innermost loop that contains the basic block GBB. */
......
2010-11-29 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/45297
* gcc.dg/graphite/pr45297.c: New.
2010-12-01 Richard Guenther <rguenther@suse.de> 2010-12-01 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46730 PR tree-optimization/46730
......
/* { dg-options "-Os -fgraphite-identity" } */
void
foo (int *p)
{
int *q = p + 1024;
while (q != p)
*--q = *--q;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment