From patchwork Mon Aug 2 20:19:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 60599 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 28692B70AF for ; Tue, 3 Aug 2010 06:21:39 +1000 (EST) Received: (qmail 21548 invoked by alias); 2 Aug 2010 20:21:32 -0000 Received: (qmail 21378 invoked by uid 22791); 2 Aug 2010 20:21:30 -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:21:20 +0000 Received: by ywe9 with SMTP id 9so1521984ywe.20 for ; Mon, 02 Aug 2010 13:21:18 -0700 (PDT) Received: by 10.100.209.8 with SMTP id h8mr6772317ang.251.1280780478799; Mon, 02 Aug 2010 13:21:18 -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 b17sm10325439anh.25.2010.08.02.13.21.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 02 Aug 2010 13:21:18 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Mon, 02 Aug 2010 15:21:14 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: Tobias Grosser , gcc-graphite Subject: [PATCH 01/65] Fix invariant phi node removal. Date: Mon, 2 Aug 2010 15:19:34 -0500 Message-Id: <1280780438-17543-2-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-05-07 Sebastian Pop * graphite-sese-to-poly.c (loop_entry_phi_arg): Renamed phi_arg_in_outermost_loop. (remove_simple_copy_phi): Call phi_arg_in_outermost_loop. (remove_invariant_phi): Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@159165 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/ChangeLog.graphite | 7 +++++++ gcc/graphite-sese-to-poly.c | 20 +++++++++++--------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad2b271..63e75ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2010-08-02 Sebastian Pop + * graphite-sese-to-poly.c (loop_entry_phi_arg): Renamed + phi_arg_in_outermost_loop. + (remove_simple_copy_phi): Call phi_arg_in_outermost_loop. + (remove_invariant_phi): Same. + +2010-08-02 Sebastian Pop + * common.opt (ftree-loop-distribute-patterns): New. * invoke.texi (-ftree-loop-distribute-patterns): Documented. * opts.c (decode_options): Enable flag_tree_loop_distribute_patterns diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index b45469b..00849f2 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,10 @@ +2010-05-07 Sebastian Pop + + * graphite-sese-to-poly.c (loop_entry_phi_arg): Renamed + phi_arg_in_outermost_loop. + (remove_simple_copy_phi): Call phi_arg_in_outermost_loop. + (remove_invariant_phi): Same. + 2010-04-12 Andreas Simbuerger * graphite-blocking.c diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 7f83ffc..68cb2a4 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -73,21 +73,23 @@ var_used_in_not_loop_header_phi_node (tree var) return result; } -/* Returns the index of the phi argument corresponding to the initial - value in the loop. */ +/* Returns the index of the PHI argument defined in the outermost + loop. */ static size_t -loop_entry_phi_arg (gimple phi) +phi_arg_in_outermost_loop (gimple phi) { loop_p loop = gimple_bb (phi)->loop_father; - size_t i; + size_t i, res = 0; for (i = 0; i < gimple_phi_num_args (phi); i++) if (!flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, i)->src)) - return i; + { + loop = gimple_phi_arg_edge (phi, i)->src->loop_father; + res = i; + } - gcc_unreachable (); - return 0; + return res; } /* Removes a simple copy phi node "RES = phi (INIT, RES)" at position @@ -98,7 +100,7 @@ remove_simple_copy_phi (gimple_stmt_iterator *psi) { gimple phi = gsi_stmt (*psi); tree res = gimple_phi_result (phi); - size_t entry = loop_entry_phi_arg (phi); + size_t entry = phi_arg_in_outermost_loop (phi); tree init = gimple_phi_arg_def (phi, entry); gimple stmt = gimple_build_assign (res, init); edge e = gimple_phi_arg_edge (phi, entry); @@ -118,7 +120,7 @@ remove_invariant_phi (sese region, gimple_stmt_iterator *psi) loop_p loop = loop_containing_stmt (phi); tree res = gimple_phi_result (phi); tree scev = scalar_evolution_in_region (region, loop, res); - size_t entry = loop_entry_phi_arg (phi); + size_t entry = phi_arg_in_outermost_loop (phi); edge e = gimple_phi_arg_edge (phi, entry); tree var; gimple stmt;