This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fwprop: Prevent infinite looping (PR79405)
On Fri, Mar 24, 2017 at 12:54:35PM +0100, Richard Biener wrote:
> > I have implemented the "retry things" as well fwiw, but a) it is too
> > big and invasive for stage 4, and b) it kind of sucks, needs more
> > work, even more invasive. The workaround is cheap and solves the
> > immediate problem.
>
> Agreed, still iterating over the DF uses in the first place looks like
> the bug (given this "all uses" data structure changes during propagation!).
>
> I'd have done
>
> for (BBs in RPO order)
> for (insn in BB)
> repeat:
> for (use in insn)
> if (propagate_into (use))
> goto repeat;
That is more or less how the def-use links for fwprop are built now,
but not the order that propagations are tried in. I think originally
it used all single definitions, not just those dominating their uses,
in which case something like your proposed algorithm does not work
(there can be def-use loops, even irreducible loops).
I agree it would be good to try something like you suggest in next
stage 1.
Segher