From patchwork Sat Sep 4 14:35:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikael Morin X-Patchwork-Id: 63792 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 DA4F2B7139 for ; Sun, 5 Sep 2010 00:36:26 +1000 (EST) Received: (qmail 7856 invoked by alias); 4 Sep 2010 14:36:23 -0000 Received: (qmail 7838 invoked by uid 22791); 4 Sep 2010 14:36:21 -0000 X-SWARE-Spam-Status: No, hits=1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_JMF_BL, SPF_NEUTRAL, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp21.services.sfr.fr (HELO smtp21.services.sfr.fr) (93.17.128.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Sep 2010 14:36:18 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2109.sfr.fr (SMTP Server) with ESMTP id DC1E5700008E; Sat, 4 Sep 2010 16:36:15 +0200 (CEST) Received: from gimli.local (122.183.72-86.rev.gaoland.net [86.72.183.122]) by msfrf2109.sfr.fr (SMTP Server) with ESMTP id 1CD2A7000086; Sat, 4 Sep 2010 16:36:12 +0200 (CEST) X-SFR-UUID: 20100904143613118.1CD2A7000086@msfrf2109.sfr.fr Message-ID: <4C825934.7030304@sfr.fr> Date: Sat, 04 Sep 2010 16:35:32 +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] [0/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 This fixes the regression introduced in the previous patch. It is an elemental-specific dependency problem, which can't be applied before the patch 10/11 because it needs transpose not being a library call anymore. As now transpose is always inline, there is no point having gfc_expr's inline_noncopying_intrinsic flag anymore. OK for trunk? 2010-09-03 Mikael Morin * gfortran.h (gfc_expr): Remove inline_noncopying_intrinsic attribute. * dependency.c (gfc_check_dependency): Don't depend on expr's inline_noncopying_intrinsic_attribute. * dependency.c (gfc_check_argument_var_dependency, gfc_check_argument_dependency): Ditto. Recursively check dependency as NOT_ELEMENTAL in the non-copying (=transpose) case. * trans-intrinsic.c (gfc_conv_intrinsic_function): Ditto. * resolve.c (find_noncopying_intrinsics): Remove. (resolve_function, resolve_call): Remove call to find_noncopying_intrinsics. diff --git a/dependency.c b/dependency.c index ab75bde..90b1ade 100644 --- a/dependency.c +++ b/dependency.c @@ -628,11 +628,15 @@ gfc_check_argument_var_dependency (gfc_expr *var, sym_intent intent, return gfc_check_dependency (var, expr, 1); case EXPR_FUNCTION: - if (intent != INTENT_IN && expr->inline_noncopying_intrinsic - && (arg = gfc_get_noncopying_intrinsic_argument (expr)) - && gfc_check_argument_var_dependency (var, intent, arg, elemental)) - return 1; - if (elemental) + if (intent != INTENT_IN) + { + arg = gfc_get_noncopying_intrinsic_argument (expr); + if (arg != NULL) + return gfc_check_argument_var_dependency (var, intent, arg, + NOT_ELEMENTAL); + } + + if (elemental != NOT_ELEMENTAL) { if ((expr->value.function.esym && expr->value.function.esym->attr.elemental) @@ -684,12 +688,11 @@ gfc_check_argument_dependency (gfc_expr *other, sym_intent intent, return gfc_check_argument_var_dependency (other, intent, expr, elemental); case EXPR_FUNCTION: - if (other->inline_noncopying_intrinsic) - { - other = gfc_get_noncopying_intrinsic_argument (other); - return gfc_check_argument_dependency (other, INTENT_IN, expr, - elemental); - } + other = gfc_get_noncopying_intrinsic_argument (other); + if (other != NULL) + return gfc_check_argument_dependency (other, INTENT_IN, expr, + NOT_ELEMENTAL); + return 0; default: @@ -963,8 +966,9 @@ gfc_check_dependency (gfc_expr *expr1, gfc_expr *expr2, bool identical) return 1; case EXPR_FUNCTION: - if (expr2->inline_noncopying_intrinsic) + if (gfc_get_noncopying_intrinsic_argument (expr2) != NULL) identical = 1; + /* Remember possible differences between elemental and transformational functions. All functions inside a FORALL will be pure. */ diff --git a/gfortran.h b/gfortran.h index 3c15521..2c01699 100644 --- a/gfortran.h +++ b/gfortran.h @@ -1680,11 +1680,9 @@ typedef struct gfc_expr locus where; - /* True if the expression is a call to a function that returns an array, - and if we have decided not to allocate temporary data for that array. - is_boz is true if the integer is regarded as BOZ bitpatten and is_snan + /* is_boz is true if the integer is regarded as BOZ bitpatten and is_snan denotes a signalling not-a-number. */ - unsigned int inline_noncopying_intrinsic : 1, is_boz : 1, is_snan : 1; + unsigned int is_boz : 1, is_snan : 1; /* Sometimes, when an error has been emitted, it is necessary to prevent it from recurring. */ diff --git a/resolve.c b/resolve.c index 4b6ac1d..620dfd5 100644 --- a/resolve.c +++ b/resolve.c @@ -1913,25 +1913,6 @@ resolve_elemental_actual (gfc_expr *expr, gfc_code *c) } -/* Go through each actual argument in ACTUAL and see if it can be - implemented as an inlined, non-copying intrinsic. FNSYM is the - function being called, or NULL if not known. */ - -static void -find_noncopying_intrinsics (gfc_symbol *fnsym, gfc_actual_arglist *actual) -{ - gfc_actual_arglist *ap; - gfc_expr *expr; - - for (ap = actual; ap; ap = ap->next) - if (ap->expr - && (expr = gfc_get_noncopying_intrinsic_argument (ap->expr)) - && !gfc_check_fncall_dependency (expr, INTENT_IN, fnsym, actual, - NOT_ELEMENTAL)) - ap->expr->inline_noncopying_intrinsic = 1; -} - - /* This function does the checking of references to global procedures as defined in sections 18.1 and 14.1, respectively, of the Fortran 77 and 95 standards. It checks for a gsymbol for the name, making @@ -3112,15 +3093,6 @@ resolve_function (gfc_expr *expr) gfc_expr_set_symbols_referenced (expr->ts.u.cl->length); } - if (t == SUCCESS - && !((expr->value.function.esym - && expr->value.function.esym->attr.elemental) - || - (expr->value.function.isym - && expr->value.function.isym->elemental))) - find_noncopying_intrinsics (expr->value.function.esym, - expr->value.function.actual); - /* Make sure that the expression has a typespec that works. */ if (expr->ts.type == BT_UNKNOWN) { @@ -3599,8 +3571,6 @@ resolve_call (gfc_code *c) if (resolve_elemental_actual (NULL, c) == FAILURE) return FAILURE; - if (t == SUCCESS && !(c->resolved_sym && c->resolved_sym->attr.elemental)) - find_noncopying_intrinsics (c->resolved_sym, c->ext.actual); return t; } diff --git a/trans-intrinsic.c b/trans-intrinsic.c index 4ff941f..f924eae 100644 --- a/trans-intrinsic.c +++ b/trans-intrinsic.c @@ -5198,7 +5198,7 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr) name = &expr->value.function.name[2]; - if (expr->rank > 0 && !expr->inline_noncopying_intrinsic) + if (expr->rank > 0) { lib = gfc_is_intrinsic_libcall (expr); if (lib != 0)