From patchwork Sat Sep 4 14:29:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 63788 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 45DF5B7143 for ; Sun, 5 Sep 2010 00:30:45 +1000 (EST) Received: (qmail 2390 invoked by alias); 4 Sep 2010 14:30:42 -0000 Received: (qmail 2376 invoked by uid 22791); 4 Sep 2010 14:30:42 -0000 X-SWARE-Spam-Status: No, hits=1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_JMF_BL, SPF_NEUTRAL, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp23.services.sfr.fr (HELO smtp23.services.sfr.fr) (93.17.128.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Sep 2010 14:30:37 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2302.sfr.fr (SMTP Server) with ESMTP id A88697000095; Sat, 4 Sep 2010 16:30:34 +0200 (CEST) Received: from gimli.local (122.183.72-86.rev.gaoland.net [86.72.183.122]) by msfrf2302.sfr.fr (SMTP Server) with ESMTP id 389CC7000093; Sat, 4 Sep 2010 16:30:33 +0200 (CEST) X-SFR-UUID: 20100904143034231.389CC7000093@msfrf2302.sfr.fr Message-ID: <4C8257E1.3010400@sfr.fr> Date: Sat, 04 Sep 2010 16:29:53 +0200 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; fr-FR; rv:1.9.1.11) Gecko/20100725 Thunderbird/3.0.6 MIME-Version: 1.0 To: "fortran@gcc.gnu.org" , gcc-patches Subject: [Patch, fortran] [7/11] Inline transpose part 1 References: <4C8254A0.9020907@sfr.fr> In-Reply-To: <4C8254A0.9020907@sfr.fr> 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 Two identical array refs need a temporary if one is transposed w.r.t the other. OK for trunk? 2010-09-03 Mikael Morin * trans-array.c (gfc_conv_resolve_dependencies): Handle same-array transposed references. diff --git a/trans-array.c b/trans-array.c index 148bf6b..371654c 100644 --- a/trans-array.c +++ b/trans-array.c @@ -3516,6 +3516,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, gfc_ref *lref; gfc_ref *rref; int nDepend = 0; + int i, j; loop->temp_ss = NULL; @@ -3542,6 +3543,17 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, if (nDepend == 1) break; + + for (i = 0; i < dest->data.info.dimen; i++) + for (j = 0; j < ss->data.info.dimen; j++) + if (i != j + && dest->data.info.dim[i] == ss->data.info.dim[j]) + { + /* If we don't access array elements in the same order, + there is a dependency. */ + nDepend = 1; + goto temporary; + } #if 0 /* TODO : loop shifting. */ if (nDepend == 1) @@ -3580,6 +3592,8 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest, } } +temporary: + if (nDepend == 1) { tree base_type = gfc_typenode_for_spec (&dest->expr->ts);