This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CFG] Loop unrolling
Hello.
> > > I feel bit unconfortable to check in the code that is known to produce invalid
> > > results even th te devel branch.
> >
> > It should be correct in all useful cases. If someone relies on how program
> > behave when counter overflows, he deserve his program not to work :-) But
> > you're probably right with this.
>
> Well, thats the matter of opinion. C stanrad specifies the overflow behaviour
> on unisgned arithmetics, so it is perfectly correct to make unsigned loops
> overflow and sometimes it even makes sense (when you need to iterate 2^32 times).
IMHO standard doesn't specify sizeof(int), so using it this way is not too
reliable. Also I do not optimize loops that use unsigned comparison in their
exit condition at all now, exactly to avoid these problems. Unfortunately,
if someone tests for equality and uses overflow, I may run into problems.
I will look to it.
> Signed counters are undefined on overflow, but unfortunately enought we don't
> have that information at unroll time, so we must be conservative.
>
> With midrtl it should be easy to add flag of PLUS operand mentioning the
> signedness (overflow behaviour), but with lowlevel rtl we must play conservative
> game.
> >
> > > Also it would be probably desriable to split those two big functions to smaller
> > > one.
> >
> > Which two you mean?
>
> Just the first two fucntion (simple loop tester and iteration count
> determining code) are bit large. THe are likely to grow over the time
> I guess (at least the second one)
I will try to.
Zdenek