------- Comment #14 from rakdver at gcc dot gnu dot org 2006-04-07 13:20
-------
(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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23855