This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] [44/66] inline sum and product: Update the scalarizer: New gfc_ss::nested_ss field.


To be able, from one outer gfc_ss struct, to descend into the corresponding
inner gfc_ss struct in the nested loop, this introduces a nested_ss field.
OK?

Attachment: pr43829-44.CL
Description: Text document

diff --git a/trans-expr.c b/trans-expr.c
index 72d35f8..4cfdc3e 100644
--- a/trans-expr.c
+++ b/trans-expr.c
@@ -92,7 +92,8 @@ gfc_advance_se_ss_chain (gfc_se * se)
   while (p != NULL)
     {
       /* Simple consistency check.  */
-      gcc_assert (p->parent == NULL || p->parent->ss == p->ss);
+      gcc_assert (p->parent == NULL || p->parent->ss == p->ss
+		  || p->parent->ss->nested_ss == p->ss);
 
       /* If we were in a nested loop, the next scalarized expression can be
 	 on the parent ss' next pointer.  Thus we should not take the next
diff --git a/trans.h b/trans.h
index 53c5ce2..0608879 100644
--- a/trans.h
+++ b/trans.h
@@ -249,6 +249,11 @@ typedef struct gfc_ss
   /* Non-null if the ss is part of a nested loop.  */
   struct gfc_ss *parent;
 
+  /* If the evaluation of an expression requires a nested loop (for example
+     if the sum intrinsic is evaluated inline), this points to the nested
+     loop's gfc_ss.  */
+  struct gfc_ss *nested_ss;
+
   /* The loop this gfc_ss is in.  */
   struct gfc_loopinfo *loop;
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]