From patchwork Mon Jul 12 16:59:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 58634 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 1150CB6F14 for ; Tue, 13 Jul 2010 03:00:28 +1000 (EST) Received: (qmail 9856 invoked by alias); 12 Jul 2010 17:00:25 -0000 Received: (qmail 9835 invoked by uid 22791); 12 Jul 2010 17:00:24 -0000 X-SWARE-Spam-Status: No, hits=0.8 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp22.services.sfr.fr (HELO smtp22.services.sfr.fr) (93.17.128.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Jul 2010 17:00:20 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2221.sfr.fr (SMTP Server) with ESMTP id 6AE0B700009B; Mon, 12 Jul 2010 19:00:18 +0200 (CEST) Received: from gimli.local (20.183.72-86.rev.gaoland.net [86.72.183.20]) by msfrf2221.sfr.fr (SMTP Server) with ESMTP id 150517000090; Mon, 12 Jul 2010 19:00:17 +0200 (CEST) X-SFR-UUID: 20100712170018861.150517000090@msfrf2221.sfr.fr Message-ID: <4C3B4A0F.30908@sfr.fr> Date: Mon, 12 Jul 2010 18:59:59 +0200 From: Mikael Morin User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; fr-FR; rv:1.9.1.10) Gecko/20100704 Thunderbird/3.0.5 MIME-Version: 1.0 To: gcc-patches , "fortran@gcc.gnu.org" Subject: [Patch, fortran] Remove gfc_conv_section_upper_bound 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 Hello, gfc_conv_section_upper_bound is the same code as the upper bound parts of gfc_conv_section_startstride, with the difference that it returns a NULL value in the vector subscript case, instead of a gfc_index_zero_node. The attached patch moves that difference into gfc_conv_section_startstride and removes gfc_conv_section_upper_bound. No testsuite regression on x86_64-unknown-freebsd8.0. OK for trunk ? Mikael 2010-07-12 Mikael Morin * trans-array.c (gfc_conv_section_upper_bound): Remove (gfc_conv_section_startstride): Don't set the upper bound in the vector subscript case. (gfc_conv_loop_setup): Don't use gfc_conv_section_upper_bound diff --git a/trans-array.c b/trans-array.c index bc26835..c43f641 100644 --- a/trans-array.c +++ b/trans-array.c @@ -2964,50 +2964,6 @@ gfc_trans_scalarized_loop_boundary (gfc_loopinfo * loop, stmtblock_t * body) } -/* Calculate the upper bound of an array section. */ - -static tree -gfc_conv_section_upper_bound (gfc_ss * ss, int n, stmtblock_t * pblock) -{ - int dim; - gfc_expr *end; - tree desc; - tree bound; - gfc_se se; - gfc_ss_info *info; - - gcc_assert (ss->type == GFC_SS_SECTION); - - info = &ss->data.info; - dim = info->dim[n]; - - if (info->ref->u.ar.dimen_type[dim] == DIMEN_VECTOR) - /* We'll calculate the upper bound once we have access to the - vector's descriptor. */ - return NULL; - - gcc_assert (info->ref->u.ar.dimen_type[dim] == DIMEN_RANGE); - desc = info->descriptor; - end = info->ref->u.ar.end[dim]; - - if (end) - { - /* The upper bound was specified. */ - gfc_init_se (&se, NULL); - gfc_conv_expr_type (&se, end, gfc_array_index_type); - gfc_add_block_to_block (pblock, &se.pre); - bound = se.expr; - } - else - { - /* No upper bound was specified, so use the bound of the array. */ - bound = gfc_conv_array_ubound (desc, dim); - } - - return bound; -} - - /* Calculate the lower bound of an array section. */ static void @@ -3030,8 +2986,8 @@ gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int n) { /* We use a zero-based index to access the vector. */ info->start[n] = gfc_index_zero_node; - info->end[n] = gfc_index_zero_node; info->stride[n] = gfc_index_one_node; + info->end[n] = NULL; return; } @@ -3688,11 +3644,7 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) case GFC_SS_SECTION: /* Use the end expression if it exists and is not constant, so that it is only evaluated once. */ - if (info->end[n] && !INTEGER_CST_P (info->end[n])) - loop->to[n] = info->end[n]; - else - loop->to[n] = gfc_conv_section_upper_bound (loopspec[n], n, - &loop->pre); + loop->to[n] = info->end[n]; break; case GFC_SS_FUNCTION: