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
This commit is contained in:
Mikael Morin 2011-11-03 23:17:08 +00:00
parent 4164579308
commit 2eace29ac3
4 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,11 @@
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.

View File

@ -3193,7 +3193,8 @@ gfc_trans_scalarizing_loops (gfc_loopinfo * loop, stmtblock_t * body)
/* Clear all the used flags. */
for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain)
ss->info->useflags = 0;
if (ss->parent == NULL)
ss->info->useflags = 0;
}

View File

@ -83,6 +83,7 @@ void
gfc_advance_se_ss_chain (gfc_se * se)
{
gfc_se *p;
gfc_ss *ss;
gcc_assert (se != NULL && se->ss != NULL && se->ss != gfc_ss_terminator);
@ -93,7 +94,15 @@ gfc_advance_se_ss_chain (gfc_se * se)
/* Simple consistency check. */
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;
}

View File

@ -246,6 +246,9 @@ typedef struct gfc_ss
struct gfc_ss *loop_chain;
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. */
struct gfc_loopinfo *loop;