This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unrolling


> If you can provide source examples which show C++ & Java creating empty
> loops behind the programmer's back it would go a long way to convincing
> everyone that eliminating empty loops is a good idea.

This is what actually started this whole thread. For

class A {
  int i;
public:
  A(){};
};

int main() 
{
  A a[1000];
}

i486-pc-linux-gnu/egcs-2.91.34/cc1plus -O2 produces

        movl $999,%eax
        .align 4
.L5:
        subl $1,%eax
        jnc .L5

It recognizes that the constructor is inline, but fails to recognize
that this makes the loop trivial.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]