From: Sebastian Pop Date: Wed, 1 Dec 2010 17:24:57 +0000 (+0000) Subject: Do not rewrite out of SSA scalar dependences crossing the limits of the scop. X-Git-Tag: releases/gcc-4.6.0~2212 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70a2ae0f4570a91c23b554761dc105c899fce4bb;p=thirdparty%2Fgcc.git Do not rewrite out of SSA scalar dependences crossing the limits of the scop. 2010-11-22 Sebastian Pop * graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits): New. (rewrite_cross_bb_scalar_deps): Pass in the scop. Call handle_scalar_deps_crossing_scop_limits. (rewrite_cross_bb_scalar_deps_out_of_ssa): Create an empty BB after the scop. Update call to rewrite_cross_bb_scalar_deps. From-SVN: r167347 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9cd9e1383ace..cd8f8368c67f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2010-12-01 Sebastian Pop + + * graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits): + New. + (rewrite_cross_bb_scalar_deps): Pass in the scop. Call + handle_scalar_deps_crossing_scop_limits. + (rewrite_cross_bb_scalar_deps_out_of_ssa): Create an empty BB + after the scop. Update call to rewrite_cross_bb_scalar_deps. + 2010-12-01 Sebastian Pop * sese.c (rename_uses): Call recompute_tree_invariant_for_addr_expr @@ -29,9 +38,9 @@ * opts.c: Expand comment on tm.h include. -2010-12-01 Yao Qi +2010-12-01 Yao Qi - * config/arm/predicates.md ("vfp_register_operand"): Return true for + * config/arm/predicates.md ("vfp_register_operand"): Return true for VFP_D0_D7_REGS classes. 2010-12-01 Joseph Myers diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 1746711392ec..08a48477d052 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,12 @@ +2010-11-22 Sebastian Pop + + * graphite-sese-to-poly.c (handle_scalar_deps_crossing_scop_limits): + New. + (rewrite_cross_bb_scalar_deps): Pass in the scop. Call + handle_scalar_deps_crossing_scop_limits. + (rewrite_cross_bb_scalar_deps_out_of_ssa): Create an empty BB + after the scop. Update call to rewrite_cross_bb_scalar_deps. + 2010-11-22 Sebastian Pop * sese.c (rename_uses): Call recompute_tree_invariant_for_addr_expr diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 2e56d7a088a3..1697e6303854 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2425,13 +2425,57 @@ rewrite_cross_bb_scalar_dependence (tree zero_dim_array, tree def, gimple use_st update_stmt (use_stmt); } +/* For every definition DEF in the SCOP that is used outside the scop, + insert a closing-scop definition in the basic block just after this + SCOP. */ + +static void +handle_scalar_deps_crossing_scop_limits (scop_p scop, tree def, gimple stmt) +{ + tree var = create_tmp_reg (TREE_TYPE (def), NULL); + tree new_name = make_ssa_name (var, stmt); + bool needs_copy = false; + use_operand_p use_p; + imm_use_iterator imm_iter; + gimple use_stmt; + sese region = SCOP_REGION (scop); + + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) + { + if (!bb_in_sese_p (gimple_bb (use_stmt), region)) + { + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + { + SET_USE (use_p, new_name); + } + update_stmt (use_stmt); + needs_copy = true; + } + } + + /* Insert in the empty BB just after the scop a use of DEF such + that the rewrite of cross_bb_scalar_dependences won't insert + arrays everywhere else. */ + if (needs_copy) + { + gimple assign = gimple_build_assign (new_name, def); + gimple_stmt_iterator psi = gsi_after_labels (SESE_EXIT (region)->dest); + + add_referenced_var (var); + SSA_NAME_DEF_STMT (new_name) = assign; + update_stmt (assign); + gsi_insert_before (&psi, assign, GSI_SAME_STMT); + } +} + /* Rewrite the scalar dependences crossing the boundary of the BB containing STMT with an array. Return true when something has been changed. */ static bool -rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) +rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi) { + sese region = SCOP_REGION (scop); gimple stmt = gsi_stmt (*gsi); imm_use_iterator imm_iter; tree def; @@ -2472,6 +2516,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) def_bb = gimple_bb (stmt); + handle_scalar_deps_crossing_scop_limits (scop, def, stmt); + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) if (gimple_code (use_stmt) == GIMPLE_PHI && (res = true)) @@ -2511,14 +2557,18 @@ void rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop) { basic_block bb; + basic_block exit; gimple_stmt_iterator psi; sese region = SCOP_REGION (scop); bool changed = false; + /* Create an extra empty BB after the scop. */ + exit = split_edge (SESE_EXIT (region)); + FOR_EACH_BB (bb) if (bb_in_sese_p (bb, region)) for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi)) - changed |= rewrite_cross_bb_scalar_deps (region, &psi); + changed |= rewrite_cross_bb_scalar_deps (scop, &psi); if (changed) {