This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CFG] handle loop with multiple exits
> Hello.
>
> > Here I guess you need to ensure test to be const_true_rtx as well,
> > otherwise we can lose for loops of type
> > for (i=a;a<a+10;i++)
> > where a+10 wraps around, so the loop never iterates.
>
> Right.
>
> > We also may handle it later in unroll_loop_constant_iterations (keep the
> > test around in single peeling of the loop).
>
> No -- this is what I want to avoid (having such tests spread around the code
Me too :)
But then the loops above won't get unrolled as well as they can.
We will classify them as runtime_iterations and emit the jump tree in front
of the loop.
> so that nobody knows what's going on).
>
> > How do we behave on loops with multiple exits?
> > For instance loop of style:
> >
> > for (i=0;i<10 && cond2; i++)
> > won't get clasified as simple loop in the old unroller, since cond2 is the last
> > test in the loop.
>
> We clasify it as simple; any problem with this?
Really? I much check.
For the old code the showstopper was that the comparison with i was not the
last instruction in the loop.
Honza
>
> Zdenek