On Mon, May 20, 2019 at 4:00 PM Feng Xue OS <f...@os.amperecomputing.com> wrote:
>
> >> I specialized a CD-DCE pass, named CD-DCE2, and only in this pass, loop 
> >> removal based on assumed finteness is performed. Please check the patch.
>
>
> > Oh, but why not generally do this?
>
> It is nature that real finiteness of loop should override assumed one. As you 
> said, CD-DCE could be invocated as an early pass. At that time, we might make 
> mistake deduction on finiteness for a loop whose bound is in form of 
> variable, but could be transformed to constant by later optimizations. So it 
> is not "safe" to generally do this in CD-DCE. We need one late and specific 
> pass.

I don't see how it is safe in a late pass when it is not safe in an
earlier one.  Optimization is imperfect - we could fail to remove
an "obvious" never taken exit and still have a loop that appears to be
finite according to our definition.  The only way
to define it would be if there was, at any point, an exit from the
loop (and there it _may_ be exclude EH edges) then
the loop is assumed to be finite.

Richard.

> Feng

Reply via email to