From patchwork Mon Nov 8 21:41:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 70465 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 84B9AB7104 for ; Tue, 9 Nov 2010 08:42:40 +1100 (EST) Received: (qmail 19776 invoked by alias); 8 Nov 2010 21:42:38 -0000 Received: (qmail 19768 invoked by uid 22791); 8 Nov 2010 21:42:37 -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_ZJ X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Nov 2010 21:42:32 +0000 Received: by gyf3 with SMTP id 3so4044606gyf.20 for ; Mon, 08 Nov 2010 13:42:30 -0800 (PST) Received: by 10.91.26.29 with SMTP id d29mr5930191agj.109.1289252548511; Mon, 08 Nov 2010 13:42:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.91.95.8 with HTTP; Mon, 8 Nov 2010 13:41:47 -0800 (PST) From: Sebastian Pop Date: Mon, 8 Nov 2010 15:41:47 -0600 Message-ID: Subject: Fix PR45314: backporting a patch from 4.6 To: GCC Patches , Richard Guenther 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, The attached patch back-ports a change from the 4.6 changes to Graphite that fixed http://gcc.gnu.org/PR45314 Passed bootstrap and test on amd64-linux. Ok for the 4.5 branch? Thanks, Sebastian From 1b7565f4c7a1a72d8ad81fbb359fafb1ed370e51 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Fri, 5 Nov 2010 13:15:25 -0500 Subject: [PATCH] Fix PR45314: backport revision 163123. 2010-11-04 Sebastian Pop PR tree-optimization/45902 Backport of revision 163132. * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out of SSA copies on edges except for loop->latch. --- gcc/ChangeLog | 7 +++++ gcc/graphite-sese-to-poly.c | 56 ++++-------------------------------------- 2 files changed, 13 insertions(+), 50 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91096cd..89606ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-04 Sebastian Pop + + PR tree-optimization/45902 + Backport of revision 163132. + * graphite-sese-to-poly.c (rewrite_phi_out_of_ssa): Always insert out + of SSA copies on edges except for loop->latch. + 2010-11-04 Uros Bizjak Revert: diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index d4bb8a3..b12210b 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -2231,58 +2231,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))))) - insert_out_of_ssa_copy (zero_dim_array, 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); 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); -- 1.7.0.4