From patchwork Thu Jul 29 20:21:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] Fix miscompile of 416.gamess. Date: Thu, 29 Jul 2010 10:21:16 -0000 From: Sebastian Pop X-Patchwork-Id: 60313 Message-Id: <1280434877-24563-2-git-send-email-sebpop@gmail.com> To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, Sebastian Pop 2010-07-29 Sebastian Pop * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add back the case removed in the previous patch, when the only phi argument is defined in the same loop as the phi node itself. Handle it separately from the invariant case by both propagating it outside the region and replacing the phi node with an assign. --- gcc/ChangeLog.graphite | 8 ++++++++ gcc/graphite-sese-to-poly.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 77aa85c..e040d6e 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,11 @@ +2010-07-29 Sebastian Pop + + * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add back + the case removed in the previous patch, when the only phi argument + is defined in the same loop as the phi node itself. Handle it + separately from the invariant case by both propagating it outside + the region and replacing the phi node with an assign. + 2010-07-28 Sebastian Pop * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): The only diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 05a0e8f..1503e2c 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2248,6 +2248,16 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi, sese region) return; } + else if (gimple_bb (SSA_NAME_DEF_STMT (arg))->loop_father == bb->loop_father) + { + propagate_expr_outside_region (res, arg, region); + stmt = gimple_build_assign (res, arg); + remove_phi_node (psi, false); + gsi_insert_before (&gsi, stmt, GSI_NEW_STMT); + SSA_NAME_DEF_STMT (res) = stmt; + return; + } + /* If res is scev analyzable and is not a scalar value, it is safe to ignore the close phi node: it will be code generated in the out of Graphite pass. */