diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-01-24 00:59:51 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-01-24 00:59:51 +0000 |
commit | 8db3fb7b2cb8cea3cfedc394100e21a2babe2f7e (patch) | |
tree | 1a379d5668d1da83b452efb96fbb212b8a824b8a /gcc/graphite.c | |
parent | 07c85d581f5e52392c07e0e55417c17b98688318 (diff) | |
download | gcc-8db3fb7b2cb8cea3cfedc394100e21a2babe2f7e.tar.gz |
2009-01-24 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/38953
* graphite.c (graphite_verify): Add a call to verify_loop_closed_ssa.
(scop_adjust_phis_for_liveouts): Initialize false_i to zero.
(gloog): Split the exit of the scop when the scop exit is a loop exit.
(graphite_transform_loops): Only call cleanup_tree_cfg if gloog
changed the CFG.
* gfortran.dg/graphite/pr38953.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143599 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite.c')
-rw-r--r-- | gcc/graphite.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/gcc/graphite.c b/gcc/graphite.c index f169f725290..3cb24b86b16 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -2178,6 +2178,7 @@ graphite_verify (void) verify_dominators (CDI_DOMINATORS); verify_dominators (CDI_POST_DOMINATORS); verify_ssa (false); + verify_loop_closed_ssa (); #endif } @@ -5229,7 +5230,8 @@ scop_adjust_phis_for_liveouts (scop_p scop, basic_block bb, edge false_e, for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) { - unsigned i, false_i; + unsigned i; + unsigned false_i = 0; gimple phi = gsi_stmt (si); if (!is_gimple_reg (PHI_RESULT (phi))) @@ -5376,9 +5378,9 @@ compute_cloog_iv_types (struct clast_stmt *stmt) } /* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for - the given SCOP. */ + the given SCOP. Return true if code generation succeeded. */ -static void +static bool gloog (scop_p scop, struct clast_stmt *stmt) { edge new_scop_exit_edge = NULL; @@ -5387,6 +5389,19 @@ gloog (scop_p scop, struct clast_stmt *stmt) loop_p context_loop; ifsese if_region = NULL; + /* To maintain the loop closed SSA form, we have to keep the phi + nodes after the last loop in the scop. */ + if (loop_depth (SESE_EXIT (SCOP_REGION (scop))->dest->loop_father) + != loop_depth (SESE_EXIT (SCOP_REGION (scop))->src->loop_father)) + { + basic_block bb = SESE_EXIT (SCOP_REGION (scop))->dest; + SESE_EXIT (SCOP_REGION (scop)) = split_block_after_labels (bb); + bitmap_set_bit (SCOP_BBS_B (scop), bb->index); + pointer_set_insert (SESE_REGION_BBS (SCOP_REGION (scop)), bb); + } + + recompute_all_dominators (); + graphite_verify (); if_region = move_sese_in_condition (SCOP_REGION (scop)); sese_build_livein_liveouts (SCOP_REGION (scop)); scop_insert_phis_for_liveouts (SCOP_REGION (scop), @@ -5412,6 +5427,7 @@ gloog (scop_p scop, struct clast_stmt *stmt) recompute_all_dominators (); graphite_verify (); + return true; } /* Returns the number of data references in SCOP. */ @@ -6040,6 +6056,7 @@ graphite_transform_loops (void) { int i; scop_p scop; + bool transform_done = false; if (number_of_loops () <= 1) return; @@ -6098,7 +6115,7 @@ graphite_transform_loops (void) } if (graphite_apply_transformations (scop)) - gloog (scop, find_transform (scop)); + transform_done = gloog (scop, find_transform (scop)); #ifdef ENABLE_CHECKING else { @@ -6109,7 +6126,9 @@ graphite_transform_loops (void) } /* Cleanup. */ - cleanup_tree_cfg (); + if (transform_done) + cleanup_tree_cfg (); + free_scops (current_scops); cloog_finalize (); free_original_copy_tables (); |