Struggle with FOR_EACH_EDGE
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Sun May 1 17:24:00 GMT 2005
Hello,
> >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.
you can always start the index from number of edges - 1 and iterate to zero.
But a proper iterator might be useful anyway.
Zdenek
More information about the Gcc
mailing list