user-guided speculative precomputation? (my wacky ia64 idea)
Daniel Jacobowitz
drow@false.org
Wed Apr 7 04:45:00 GMT 2004
On Tue, Apr 06, 2004 at 09:52:51PM -0400, James Morrison wrote:
>
> Duraid Madina <duraid@octopus.com.au> writes:
> > This #pragma would be added to code such as (taken from
> > http://www.intel.com/technology/itj/2002/volume06issue01/art03_specprecomp/p06_xeon.htm
> > )
> >
> > {
> > n = NodeArray[0];
> > while(n && remaining)
> > {
> > doSomeWork();
> > #pragma delinquent_load
> > n->i = n->next->j + n->next->k + n->next->l;
> > n = n->next;
> > remaining--;
> > }
> > }
> >
>
> I'm not sure if I should be scared by this example or put it up to lazyness.
> However, n is going to be compared each time we go through the loop even
> though it is only supposed to be tested once. If n is ever 0 at the top of
> the loop, after executing the loop, then a segfault would have already occured.
> I don't suppose it's possible to optimize this, is it?
Eh, you're incorrect. Note the n = n->next at the bottom of the loop.
In general, if the circumstance you're describing had actually occured
in this example - yes, I believe that at least tree-ssa or lno could
optimize this. There would be a non-null marker on the dereferenced
pointer, which would reach a PHI at the top of the loop.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
More information about the Gcc
mailing list