From patchwork Sat Sep 4 14:21:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 63780 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 58363B7147 for ; Sun, 5 Sep 2010 00:22:02 +1000 (EST) Received: (qmail 26860 invoked by alias); 4 Sep 2010 14:21:59 -0000 Received: (qmail 26845 invoked by uid 22791); 4 Sep 2010 14:21:58 -0000 X-SWARE-Spam-Status: No, hits=1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_JMF_BL, SPF_NEUTRAL, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp24.services.sfr.fr (HELO smtp24.services.sfr.fr) (93.17.128.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Sep 2010 14:21:54 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2416.sfr.fr (SMTP Server) with ESMTP id D61F1700008E; Sat, 4 Sep 2010 16:21:52 +0200 (CEST) Received: from gimli.local (122.183.72-86.rev.gaoland.net [86.72.183.122]) by msfrf2416.sfr.fr (SMTP Server) with ESMTP id 99477700008C; Sat, 4 Sep 2010 16:21:51 +0200 (CEST) X-SFR-UUID: 20100904142151627.99477700008C@msfrf2416.sfr.fr Message-ID: <4C8255D2.4020002@sfr.fr> Date: Sat, 04 Sep 2010 16:21:06 +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] [2/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 Obvious and not absolutely necessary: As we are using n to access the loop bounds, let's stop on the loop dimension instead of the array dimension. I've added an assert to check that it is effectively the same. The trans-stmt.c change is there to prevent the assert from triggering. OK for trunk? 2010-09-03 Mikael Morin * trans-array.c (gfc_trans_create_temp_array): Assert loop dimension and info dimension are the same. Loop over loop dimension. * trans-stmt.c (gfc_conv_elemental_dependencies): Set loop dimension diff --git a/trans-array.c b/trans-array.c index 7cd890e..5902aff 100644 --- a/trans-array.c +++ b/trans-array.c @@ -733,6 +733,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, int dim; gcc_assert (info->dimen > 0); + gcc_assert (loop->dimen == info->dimen); if (gfc_option.warn_array_temp && where) gfc_warning ("Creating array temporary at %L", where); @@ -786,15 +787,15 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, /* If there is at least one null loop->to[n], it is a callee allocated array. */ - for (n = 0; n < info->dimen; n++) + for (n = 0; n < loop->dimen; n++) if (loop->to[n] == NULL_TREE) { size = NULL_TREE; break; } - for (n = 0; n < info->dimen; n++) - { + for (n = 0; n < loop->dimen; n++) + { dim = info->dim[n]; if (size == NULL_TREE) diff --git a/trans-stmt.c b/trans-stmt.c index 29b3322..f058a2d 100644 --- a/trans-stmt.c +++ b/trans-stmt.c @@ -240,6 +240,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, /* Make a local loopinfo for the temporary creation, so that none of the other ss->info's have to be renormalized. */ gfc_init_loopinfo (&tmp_loop); + tmp_loop.dimen = info->dimen; for (n = 0; n < info->dimen; n++) { tmp_loop.to[n] = loopse->loop->to[n];