From patchwork Mon Aug 2 20:19:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60617 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 AB335B6EFE for ; Tue, 3 Aug 2010 06:24:44 +1000 (EST) Received: (qmail 25983 invoked by alias); 2 Aug 2010 20:22:35 -0000 Received: (qmail 25762 invoked by uid 22791); 2 Aug 2010 20:22:31 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_SV, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:22:26 +0000 Received: by mail-gw0-f47.google.com with SMTP id 15so1552327gwb.20 for ; Mon, 02 Aug 2010 13:22:25 -0700 (PDT) Received: by 10.100.96.17 with SMTP id t17mr6877954anb.109.1280780545339; Mon, 02 Aug 2010 13:22:25 -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 p12sm10329269ane.14.2010.08.02.13.22.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:22:24 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:22:21 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 19/65] Always insert out of SSA copies on edges except for loop->latch. Date: Mon, 2 Aug 2010 15:19:52 -0500 Message-Id: <1280780438-17543-20-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-23 Sebastian Pop * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out of SSA copies on edges except for loop->latch. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@161292 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++++ gcc/ChangeLog.graphite | 5 ++++ gcc/graphite-sese-to-poly.c | 54 ++++--------------------------------------- 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfdc49a..ec97649 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out + of SSA copies on edges except for loop->latch. + +2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps_out_of_ssa): Split out of rewrite_reductions_out_of_ssa. * graphite-sese-to-poly.h (rewrite_cross_bb_scalar_deps_out_of_ssa): diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 0d64cc3..47cf924 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,10 @@ 2010-06-23 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out + of SSA copies on edges except for loop->latch. + +2010-06-23 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps_out_of_ssa): Split out of rewrite_reductions_out_of_ssa. * graphite-sese-to-poly.h (rewrite_cross_bb_scalar_deps_out_of_ssa): diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 8bcd684..75879ed 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2246,58 +2246,14 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi) for (i = 0; i < gimple_phi_num_args (phi); i++) { tree arg = gimple_phi_arg_def (phi, i); + edge e = gimple_phi_arg_edge (phi, i); - /* Try to avoid the insertion on edges as much as possible: this - would avoid the insertion of code on loop latch edges, making - the pattern matching of the vectorizer happy, or it would - avoid the insertion of useless basic blocks. Note that it is - incorrect to insert out of SSA copies close by their - definition when they are more than two loop levels apart: - for example, starting from a double nested loop - - | a = ... - | loop_1 - | loop_2 - | b = phi (a, c) - | c = ... - | end_2 - | end_1 - - the following transform is incorrect - - | a = ... - | Red[0] = a - | loop_1 - | loop_2 - | b = Red[0] - | c = ... - | Red[0] = c - | end_2 - | end_1 - - whereas inserting the copy on the incoming edge is correct - - | a = ... - | loop_1 - | Red[0] = a - | loop_2 - | b = Red[0] - | c = ... - | Red[0] = c - | end_2 - | end_1 - */ - if (TREE_CODE (arg) == SSA_NAME - && is_gimple_reg (arg) - && gimple_bb (SSA_NAME_DEF_STMT (arg)) - && (flow_bb_inside_loop_p (bb->loop_father, - gimple_bb (SSA_NAME_DEF_STMT (arg))) - || flow_bb_inside_loop_p (loop_outer (bb->loop_father), - gimple_bb (SSA_NAME_DEF_STMT (arg))))) + /* Avoid the insertion of code in the loop latch to please the + pattern matching of the vectorizer. */ + if (e->src == bb->loop_father->latch) 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); + insert_out_of_ssa_copy_on_edge (e, zero_dim_array, arg); } var = force_gimple_operand (zero_dim_array, &stmts, true, NULL_TREE);