[Bug tree-optimization/23855] loop header should also be pulled out of the inner loop too
rakdver at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Apr 9 23:51:00 GMT 2006
------- Comment #15 from rakdver at gcc dot gnu dot org 2006-04-09 23:51 -------
(In reply to comment #14)
> (In reply to comment #11)
> > I updated the patch for current mainline, but it still has issues for some
> > common uses of loops:
> >
> > void foo(int *ie, int *je, double *x)
> > {
> > int i, j;
> > for (j=0; j<*je; ++j)
> > for (i=0; i<*ie; ++i)
> > x[i+j] = 0.0;
> > }
> >
> > After loop header copying we have
> >
> > if (*je > 0)
> > for (j=0; j<*je; ++j)
> > if (*ie > 0)
> > for (i=0; i<*ie; ++i)
> > x[i+j ] = 0.0;
> >
> > note how in this form we see the condition *ie > 0 not invariant wrt the
> > outer loop (because it does a memory load), but if we would run load-PRE
> > between loop header copying and guard hoisting we would get
>
> actually, thinking about it again, it should suffice to teach
> invariant_without_guard_p about invariant memory loads, and this should just
> work.
It basically does, the only other problem is that we are not able to determine
that the outer loop is not infinite.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23855
More information about the Gcc-bugs
mailing list