Commit 2eace29a by Mikael Morin

trans.h (struct gfc_ss): New field parent.

	* trans.h (struct gfc_ss): New field parent.
	* trans-array.c (gfc_trans_scalarizing_loops): Skip clearing if a
	parent exists.
	* trans-expr.c (gfc_advance_se_ss_chain): Move to parent ss at the
	end of the chain.

From-SVN: r180889
parent 41645793
2011-11-03 Mikael Morin <mikael@gcc.gnu.org> 2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans.h (struct gfc_ss): New field parent.
* trans-array.c (gfc_trans_scalarizing_loops): Skip clearing if a
parent exists.
* trans-expr.c (gfc_advance_se_ss_chain): Move to parent ss at the
end of the chain.
2011-11-03 Mikael Morin <mikael@gcc.gnu.org>
* trans-array.h (gfc_trans_create_temp_array): Remove loop argument. * trans-array.h (gfc_trans_create_temp_array): Remove loop argument.
* trans-array.c (gfc_trans_create_temp_array): Ditto. Get loop from ss. * trans-array.c (gfc_trans_create_temp_array): Ditto. Get loop from ss.
Update reference to loop. Remove loop argument. Update reference to loop. Remove loop argument.
......
...@@ -3193,7 +3193,8 @@ gfc_trans_scalarizing_loops (gfc_loopinfo * loop, stmtblock_t * body) ...@@ -3193,7 +3193,8 @@ gfc_trans_scalarizing_loops (gfc_loopinfo * loop, stmtblock_t * body)
/* Clear all the used flags. */ /* Clear all the used flags. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain) for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
ss->info->useflags = 0; if (ss->parent == NULL)
ss->info->useflags = 0;
} }
......
...@@ -83,6 +83,7 @@ void ...@@ -83,6 +83,7 @@ void
gfc_advance_se_ss_chain (gfc_se * se) gfc_advance_se_ss_chain (gfc_se * se)
{ {
gfc_se *p; gfc_se *p;
gfc_ss *ss;
gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator); gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator);
...@@ -93,7 +94,15 @@ gfc_advance_se_ss_chain (gfc_se * se) ...@@ -93,7 +94,15 @@ gfc_advance_se_ss_chain (gfc_se * se)
/* Simple consistency check. */ /* Simple consistency check. */
gcc_assert (p->parent == NULL || p->parent->ss == p->ss); gcc_assert (p->parent == NULL || p->parent->ss == p->ss);
p->ss = p->ss->next; /* 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
pointer blindly, but rather go up one nest level as long as next
is the end of chain. */
ss = p->ss;
while (ss->next == gfc_ss_terminator && ss->parent != NULL)
ss = ss->parent;
p->ss = ss->next;
p = p->parent; p = p->parent;
} }
......
...@@ -246,6 +246,9 @@ typedef struct gfc_ss ...@@ -246,6 +246,9 @@ typedef struct gfc_ss
struct gfc_ss *loop_chain; struct gfc_ss *loop_chain;
struct gfc_ss *next; struct gfc_ss *next;
/* Non-null if the ss is part of a nested loop. */
struct gfc_ss *parent;
/* The loop this gfc_ss is in. */ /* The loop this gfc_ss is in. */
struct gfc_loopinfo *loop; struct gfc_loopinfo *loop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment