From patchwork Mon Aug 2 20:19:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60611 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 EB47BB6EFE for ; Tue, 3 Aug 2010 06:23:41 +1000 (EST) Received: (qmail 25132 invoked by alias); 2 Aug 2010 20:22:14 -0000 Received: (qmail 24930 invoked by uid 22791); 2 Aug 2010 20:22:11 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_SV, TW_TM, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:22:05 +0000 Received: by ywe9 with SMTP id 9so1522213ywe.20 for ; Mon, 02 Aug 2010 13:22:03 -0700 (PDT) Received: by 10.101.8.8 with SMTP id l8mr6901601ani.84.1280780523862; Mon, 02 Aug 2010 13:22:03 -0700 (PDT) Received: from napoca (cpe-70-120-196-107.austin.res.rr.com [70.120.196.107]) by mx.google.com with ESMTPS id t24sm10330488ano.12.2010.08.02.13.22.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:22:02 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:21:58 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 13/65] Remove insert_copyout and insert_copyin. Date: Mon, 2 Aug 2010 15:19:46 -0500 Message-Id: <1280780438-17543-14-git-send-email-sebpop@gmail.com> In-Reply-To: <1280780438-17543-1-git-send-email-sebpop@gmail.com> References: <1280780438-17543-1-git-send-email-sebpop@gmail.com> 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 From: spop 2010-06-12 Sebastian Pop * graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra argument for the place after which to insert the out of SSA copy. (rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy. (rewrite_phi_out_of_ssa): Same. (rewrite_cross_bb_scalar_deps): Same. (insert_copyout): Removed. (insert_copyin): Removed. (translate_scalar_reduction_to_array): Call insert_out_of_ssa_copy and insert_out_of_ssa_copy_on_edge instead of insert_copyout and insert_copyin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@160652 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++++++++ gcc/ChangeLog.graphite | 13 ++++++++++ gcc/graphite-sese-to-poly.c | 53 ++++++++++++------------------------------ 3 files changed, 41 insertions(+), 38 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2f9d17..2985acb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,18 @@ 2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra + argument for the place after which to insert the out of SSA copy. + (rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy. + (rewrite_phi_out_of_ssa): Same. + (rewrite_cross_bb_scalar_deps): Same. + (insert_copyout): Removed. + (insert_copyin): Removed. + (translate_scalar_reduction_to_array): Call insert_out_of_ssa_copy and + insert_out_of_ssa_copy_on_edge instead of insert_copyout and + insert_copyin. + +2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore. (rewrite_reductions_out_of_ssa): Same. (rewrite_commutative_reductions_out_of_ssa): Same. diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index c74fce0..72c1876 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,18 @@ 2010-06-12 Sebastian Pop + * graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra + argument for the place after which to insert the out of SSA copy. + (rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy. + (rewrite_phi_out_of_ssa): Same. + (rewrite_cross_bb_scalar_deps): Same. + (insert_copyout): Removed. + (insert_copyin): Removed. + (translate_scalar_reduction_to_array): Call insert_out_of_ssa_copy and + insert_out_of_ssa_copy_on_edge instead of insert_copyout and + insert_copyin. + +2010-06-12 Sebastian Pop + * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore. (rewrite_reductions_out_of_ssa): Same. (rewrite_commutative_reductions_out_of_ssa): Same. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 969ef2b..2897cd6 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2117,10 +2117,10 @@ gsi_for_phi_node (gimple stmt) return psi; } -/* Insert the assignment "RES := VAR" just after the definition of VAR. */ +/* Insert the assignment "RES := VAR" just after AFTER_STMT. */ static void -insert_out_of_ssa_copy (tree res, tree var) +insert_out_of_ssa_copy (tree res, tree var, gimple after_stmt) { gimple stmt; gimple_seq stmts; @@ -2134,15 +2134,14 @@ insert_out_of_ssa_copy (tree res, tree var) si = gsi_last (stmts); gsi_insert_after (&si, stmt, GSI_NEW_STMT); - stmt = SSA_NAME_DEF_STMT (var); - if (gimple_code (stmt) == GIMPLE_PHI) + if (gimple_code (after_stmt) == GIMPLE_PHI) { - gsi = gsi_after_labels (gimple_bb (stmt)); + gsi = gsi_after_labels (gimple_bb (after_stmt)); gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT); } else { - gsi = gsi_for_stmt (stmt); + gsi = gsi_for_stmt (after_stmt); gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT); } } @@ -2218,7 +2217,7 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi) if (TREE_CODE (arg) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (arg)) - insert_out_of_ssa_copy (zero_dim_array, arg); + insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg)); else insert_out_of_ssa_copy_on_edge (single_pred_edge (gimple_bb (phi)), zero_dim_array, arg); @@ -2239,7 +2238,7 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi) basic_block bb = gimple_bb (phi); tree res = gimple_phi_result (phi); tree var = SSA_NAME_VAR (res); - tree zero_dim_array = create_zero_dim_array (var, "General_Reduction"); + tree zero_dim_array = create_zero_dim_array (var, "phi_out_of_ssa"); gimple_stmt_iterator gsi; gimple stmt; gimple_seq stmts; @@ -2295,7 +2294,7 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi) gimple_bb (SSA_NAME_DEF_STMT (arg))) || flow_bb_inside_loop_p (loop_outer (bb->loop_father), gimple_bb (SSA_NAME_DEF_STMT (arg))))) - insert_out_of_ssa_copy (zero_dim_array, arg); + insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg)); else insert_out_of_ssa_copy_on_edge (gimple_phi_arg_edge (phi, i), zero_dim_array, arg); @@ -2389,7 +2388,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) { zero_dim_array = create_zero_dim_array (SSA_NAME_VAR (def), "Cross_BB_scalar_dependence"); - insert_out_of_ssa_copy (zero_dim_array, def); + insert_out_of_ssa_copy (zero_dim_array, def, + SSA_NAME_DEF_STMT (def)); gsi_next (gsi); } @@ -2728,32 +2728,6 @@ translate_scalar_reduction_to_array_for_stmt (tree red, gimple stmt, gsi_insert_after (&insert_gsi, assign, GSI_SAME_STMT); } -/* Insert the assignment "result (CLOSE_PHI) = RED". */ - -static void -insert_copyout (tree red, gimple close_phi) -{ - tree res = gimple_phi_result (close_phi); - basic_block bb = gimple_bb (close_phi); - gimple_stmt_iterator insert_gsi = gsi_after_labels (bb); - gimple assign = gimple_build_assign (res, red); - - gsi_insert_before (&insert_gsi, assign, GSI_SAME_STMT); -} - -/* Insert the assignment "RED = initial_value (LOOP_PHI)". */ - -static void -insert_copyin (tree red, gimple loop_phi) -{ - gimple_seq stmts; - tree init = initial_value_for_loop_phi (loop_phi); - tree expr = build2 (MODIFY_EXPR, TREE_TYPE (init), red, init); - - force_gimple_operand (expr, &stmts, true, NULL); - gsi_insert_seq_on_edge (edge_initial_value_for_loop_phi (loop_phi), stmts); -} - /* Removes the PHI node and resets all the debug stmts that are using the PHI_RESULT. */ @@ -2829,8 +2803,11 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in, if (i == VEC_length (gimple, in) - 1) { - insert_copyout (red, close_phi); - insert_copyin (red, loop_phi); + insert_out_of_ssa_copy (gimple_phi_result (close_phi), red, + close_phi); + insert_out_of_ssa_copy_on_edge + (edge_initial_value_for_loop_phi (loop_phi), + red, initial_value_for_loop_phi (loop_phi)); } remove_phi (loop_phi);