From patchwork Wed Jun 23 20:46:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 56717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 5E7C2B6EE8 for ; Thu, 24 Jun 2010 06:47:20 +1000 (EST) Received: (qmail 7397 invoked by alias); 23 Jun 2010 20:47:15 -0000 Received: (qmail 7382 invoked by uid 22791); 23 Jun 2010 20:47:10 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_DB, TW_TM X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 20:47:02 +0000 Received: by qyk1 with SMTP id 1so99950qyk.20 for ; Wed, 23 Jun 2010 13:47:00 -0700 (PDT) Received: by 10.224.52.233 with SMTP id j41mr5332720qag.234.1277326020650; Wed, 23 Jun 2010 13:47:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.74.18 with HTTP; Wed, 23 Jun 2010 13:46:29 -0700 (PDT) From: Sebastian Pop Date: Wed, 23 Jun 2010 15:46:29 -0500 Message-ID: Subject: [patch][graphite] Fix h264ref and dealII To: gcc-graphite , GCC Patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, after the recent changes to the graphite branch, the regression testers failed on two spec2006 benchmarks. The attached patches fix these errors. Committed to the graphite branch for further testing. Sebastian Pop --- AMD / Open Source Compiler Engineering / GNU Tools From 5a744fb4155f73ebbcc0ce7c88e23821793c61b3 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Wed, 23 Jun 2010 15:29:19 -0500 Subject: [PATCH 6/6] Run rewrite_cross_bb_phi_deps before rewrite_cross_bb_scalar_deps. 2010-06-23 Sebastian Pop * graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Moved up. (rewrite_cross_bb_phi_deps): Split out of rewrite_cross_bb_scalar_deps. (rewrite_cross_bb_scalar_deps_out_of_ssa): Run rewrite_cross_bb_phi_deps before rewrite_cross_bb_scalar_deps. --- gcc/ChangeLog.graphite | 7 +++ gcc/graphite-sese-to-poly.c | 96 ++++++++++++++++++++++++++++--------------- 2 files changed, 70 insertions(+), 33 deletions(-) diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 5d142df..423fae9 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,12 @@ 2010-06-23 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_reductions_out_of_ssa): Moved up. + (rewrite_cross_bb_phi_deps): Split out of rewrite_cross_bb_scalar_deps. + (rewrite_cross_bb_scalar_deps_out_of_ssa): Run rewrite_cross_bb_phi_deps + before rewrite_cross_bb_scalar_deps. + +2010-06-23 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_commutative_reductions_out_of_ssa): Early return in when flag_associative_math is not set. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 1f676e7..d0db7fa 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2271,6 +2271,31 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi) gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT); } +/* Rewrite out of SSA all the reduction phi nodes of SCOP. */ + +void +rewrite_reductions_out_of_ssa (scop_p scop) +{ + basic_block bb; + gimple_stmt_iterator psi; + sese region = SCOP_REGION (scop); + + FOR_EACH_BB (bb) + if (bb_in_sese_p (bb, region)) + for (psi = gsi_start_phis (bb); !gsi_end_p (psi);) + { + if (scalar_close_phi_node_p (gsi_stmt (psi))) + rewrite_close_phi_out_of_ssa (&psi); + else if (reduction_phi_p (region, &psi)) + rewrite_phi_out_of_ssa (&psi); + } + + update_ssa (TODO_update_ssa); +#ifdef ENABLE_CHECKING + verify_loop_closed_ssa (true); +#endif +} + /* Return true when DEF can be analyzed in REGION by the scalar evolution analyzer. */ @@ -2313,16 +2338,16 @@ rewrite_cross_bb_scalar_dependence (tree zero_dim_array, tree def, gimple use_st } /* Rewrite the scalar dependences crossing the boundary of the BB - containing STMT with an array. */ + containing STMT with an array. GSI points to a definition that is + used in a PHI node. */ static void -rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) +rewrite_cross_bb_phi_deps (sese region, gimple_stmt_iterator gsi) { - gimple stmt = gsi_stmt (*gsi); + gimple stmt = gsi_stmt (gsi); imm_use_iterator imm_iter; tree def; basic_block def_bb; - tree zero_dim_array = NULL_TREE; gimple use_stmt; if (gimple_code (stmt) != GIMPLE_ASSIGN) @@ -2341,9 +2366,37 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) gimple_stmt_iterator si = gsi_for_stmt (use_stmt); rewrite_phi_out_of_ssa (&si); } - else if (def_bb != gimple_bb (use_stmt) - && !is_gimple_debug (use_stmt)) +} + +/* Rewrite the scalar dependences crossing the boundary of the BB + containing STMT with an array. */ + +static void +rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) +{ + gimple stmt = gsi_stmt (*gsi); + imm_use_iterator imm_iter; + tree def; + basic_block def_bb; + tree zero_dim_array = NULL_TREE; + gimple use_stmt; + + if (gimple_code (stmt) != GIMPLE_ASSIGN) + return; + + def = gimple_assign_lhs (stmt); + if (!is_gimple_reg (def) + || scev_analyzable_p (def, region)) + return; + + def_bb = gimple_bb (stmt); + + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) + if (def_bb != gimple_bb (use_stmt) + && !is_gimple_debug (use_stmt)) { + gcc_assert (gimple_code (use_stmt) != GIMPLE_PHI); + if (!zero_dim_array) { zero_dim_array = create_zero_dim_array @@ -2360,32 +2413,6 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) /* Rewrite out of SSA all the reduction phi nodes of SCOP. */ void -rewrite_reductions_out_of_ssa (scop_p scop) -{ - basic_block bb; - gimple_stmt_iterator psi; - sese region = SCOP_REGION (scop); - - FOR_EACH_BB (bb) - if (bb_in_sese_p (bb, region)) - for (psi = gsi_start_phis (bb); !gsi_end_p (psi);) - { - if (scalar_close_phi_node_p (gsi_stmt (psi))) - rewrite_close_phi_out_of_ssa (&psi); - else if (reduction_phi_p (region, &psi)) - rewrite_phi_out_of_ssa (&psi); - } - - update_ssa (TODO_update_ssa); -#ifdef ENABLE_CHECKING - verify_loop_closed_ssa (true); -#endif -} - - -/* Rewrite out of SSA all the reduction phi nodes of SCOP. */ - -void rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop) { basic_block bb; @@ -2395,7 +2422,10 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop) FOR_EACH_BB (bb) if (bb_in_sese_p (bb, region)) for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi)) - rewrite_cross_bb_scalar_deps (region, &psi); + { + rewrite_cross_bb_phi_deps (region, psi); + rewrite_cross_bb_scalar_deps (region, &psi); + } update_ssa (TODO_update_ssa); #ifdef ENABLE_CHECKING -- 1.7.0.4