From patchwork Mon Aug 2 20:20:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60638 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 AC22FB6EFE for ; Tue, 3 Aug 2010 06:27:29 +1000 (EST) Received: (qmail 32359 invoked by alias); 2 Aug 2010 20:23:59 -0000 Received: (qmail 32246 invoked by uid 22791); 2 Aug 2010 20:23:56 -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-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Aug 2010 20:23:48 +0000 Received: by yxi11 with SMTP id 11so1550776yxi.20 for ; Mon, 02 Aug 2010 13:23:47 -0700 (PDT) Received: by 10.100.197.8 with SMTP id u8mr6901672anf.44.1280780627271; Mon, 02 Aug 2010 13:23:47 -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 l6sm10331500ang.18.2010.08.02.13.23.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:23:46 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:23:43 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 41/65] Special case non close-phi nodes with one argument in rewrite_close_phi_out_of_ssa. Date: Mon, 2 Aug 2010 15:20:14 -0500 Message-Id: <1280780438-17543-42-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-07-15 Sebastian Pop * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Special case non close-phi nodes with one argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@162249 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/ChangeLog.graphite | 5 +++++ gcc/graphite-sese-to-poly.c | 28 ++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 524376d..07ee095 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Special + case non close-phi nodes with one argument. + +2010-08-02 Sebastian Pop + * sese.h (scev_analyzable_p): Scevs could be expressions without chrecs and still be scev_analyzable_p. diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index a93e035..965ed25 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,10 @@ 2010-07-15 Sebastian Pop + * graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Special + case non close-phi nodes with one argument. + +2010-07-15 Sebastian Pop + * sese.h (scev_analyzable_p): Scevs could be expressions without chrecs and still be scev_analyzable_p. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 5a8db3d..bea9c9f 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2203,22 +2203,34 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi) gimple phi = gsi_stmt (*psi); tree res = gimple_phi_result (phi); tree var = SSA_NAME_VAR (res); - tree zero_dim_array = create_zero_dim_array (var, "Close_Phi"); - gimple_stmt_iterator gsi = gsi_after_labels (gimple_bb (phi)); - gimple stmt = gimple_build_assign (res, zero_dim_array); + basic_block bb = gimple_bb (phi); + gimple_stmt_iterator gsi = gsi_after_labels (bb); tree arg = gimple_phi_arg_def (phi, 0); + gimple stmt; /* Note that loop close phi nodes should have a single argument because we translated the representation into a canonical form before Graphite: see canonicalize_loop_closed_ssa_form. */ gcc_assert (gimple_phi_num_args (phi) == 1); - if (TREE_CODE (arg) == SSA_NAME - && !SSA_NAME_IS_DEFAULT_DEF (arg)) - insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg)); + /* The phi node can be a non close phi node, when its argument is + invariant, or when it is defined in the same loop as the phi node. */ + if (is_gimple_min_invariant (arg) + || gimple_bb (SSA_NAME_DEF_STMT (arg))->loop_father == bb->loop_father) + stmt = gimple_build_assign (res, arg); else - insert_out_of_ssa_copy_on_edge (single_pred_edge (gimple_bb (phi)), - zero_dim_array, arg); + { + tree zero_dim_array = create_zero_dim_array (var, "Close_Phi"); + + stmt = gimple_build_assign (res, zero_dim_array); + + if (TREE_CODE (arg) == SSA_NAME + && !SSA_NAME_IS_DEFAULT_DEF (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 (bb), + zero_dim_array, arg); + } remove_phi_node (psi, false); gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);