Struggle with FOR_EACH_EDGE
Nathan Sidwell
nathan@codesourcery.com
Sun May 1 17:20:00 GMT 2005
Kazu Hirata wrote:
> To see what kind of code GCC generates for FOR_EACH_EDGE, I wrote a
> simple dummy function.
Kazu, I hope I have time to look in detail at your investigation, however
one thing that might be causing a problem is that FOR_EACH_EDGE is an iterator
that works for a non-constant VEC. This means there's an extra level of
indirection that the optimizer cannot remove, unless it completely inlines
the body of the loop (there might be some cases it can do it without inlining,
but I suspect not). I wonder if it is worthwhile implementing FOR_EACH_EDGE
and FOR_EACH_EDGE_VOLATILE (I want the default, shorter name, to be the
constant iterator, so that you have to chose to use the non-constant one).
Even with a constant iterator, it might be necessary to help the optimizer
by copying the vector length to somewhere local that the optimizer can see
cannot be changed by the body of the loop. Hmm, I guess that does mean you
need a proper iterator object, rather than the integer index that VEC_iterate
employs.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
More information about the Gcc
mailing list