Loop oddity

John David Anglin dave@hiauly1.hia.nrc.ca
Tue Jan 22 12:57:00 GMT 2002


> >   for (i = 1000000; i; i--) {};

> > Loop from 12 to 26: 2 real insns.
> > Continue at insn 18.
> > Biv 94: insn 20 const (-1)
> > Biv 94: verified
> > Biv 94: initialized at insn 11: initial value (1000000)
> > Cannot eliminate nonneg biv 94.
> > Sorted combine statistics:
> > 
> > Loop unrolling: 1000000 iterations.
> > Unrolling loop 25 times.
> > Biv 94 safe to split.
> > 
> > Loop from 12 to 26: 2 real insns.
> > Continue at insn 102.
> > Biv 94: insn 103 const (-25)
> > Biv 94: verified
> > Biv 94: initialized at insn 11: initial value (1000000)
> > Cannot eliminate nonneg biv 94.
> > Sorted combine statistics:
> > 
> > Loop unrolling: 40000 iterations.
> > Unrolling loop 25 times.

> I'm not seeing this effect on x86 ....  

On checking, I also don't see this on x86 with gcc-3.0.1.  I see it on
the PA and VAX with the current mainline.  The output from the loop
pass differs on x86:

Loop from 11 to 27: 3 real insns.
Continue at insn 18.
Biv 42: insn 21 const (-1)
Biv 42: verified
Biv 42: initialized at insn 10: initial value (1000000)
Cannot eliminate biv 42: biv used in insn 13.
Sorted combine statistics:



Loop from 11 to 27: 3 real insns.
Continue at insn 18.
Biv 42: insn 21 const (-1)
Biv 42: verified
Biv 42: initialized at insn 10: initial value (1000000)
Cannot eliminate biv 42: biv used in insn 13.
Sorted combine statistics:

For some reason, the unrolling noted above doesn't occur on x86.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



More information about the Gcc mailing list