Sandra Loosemore wrote:
The Fortran front end, which can create side-effect statements
associated with OpenMP iterators, had an undocumented hack to store
the STATEMENT_LIST in the BLOCKS_SUBBLOCKS field of the associated
BLOCK. Besides this being confusing, and lack of an accessor with a
unique name making it difficult to search for uses of these
statements, that field is documented in tree.def to hold only a chain
of subblocks and that could potentially lead to strange behavior in
other places not expecting to find other tree expressions there.
This patch stores the statements in the iterator vector instead, adds
a new accessor, and adjusts the code to use it.
LGTM – thanks for the cleanup!
Tobias
gcc/fortran
* trans-openmp.cc (finish_iterator_stmts): Store statements
in OMP_ITERATOR_STMTS for the iterator instead of BLOCK_SUBBLOCK
for its associated block.
gcc/
* gimplify.cc (build_omp_iterator_loop): Get statements from
OMP_ITERATOR_STMTS for the iterator instead of BLOCK_SUBBLOCK
for its associated block. Also force unsharing here.
(remove_unused_omp_iterator_vars): Likewise for copying to a new
iterator. Remove incorrect deletion of the statements from the
old iterator.
(build_omp_iterators_loops): Delete the statements here, when
we are constructing the expanded iterator, instead; they have been
incorporated into the loop body by this point.
* tree-pretty-print.cc (dump_omp_iterators): Get statements from
OMP_ITERATOR_STMTS for the iterator instead of BLOCK_SUBBLOCK
for its associated block.
* tree.h (OMP_ITERATOR_STMTS): New macro. Adjust numbering of
subsequent vector slots.
(OMP_ITERATOR_EXPANDED_P): Adjust for addition of new slot.
(make_omp_iterator, make_expanded_omp_iterator): Likewise.