diff mbox

[fortran,0/11] Inline transpose part 1

Message ID 4C825934.7030304@sfr.fr
State New
Headers show

Commit Message

Mikael Morin Sept. 4, 2010, 2:35 p.m. UTC
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  <mikael@gcc.gnu.org>

	* 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 mbox

Patch

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)