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


> Date: Wed, 10 Jun 1998 20:16:08 +0200 (MET DST)
> From: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>

> I'm the one who started this monster thread, and actually I believe that
> John Carr <jfc@mit.edu>,

His example was mistaken.  He had no ``empty'' ``loops''.

 struct x
        {
          x() {}
        };
        
        f()
        {
          x x1[10];
        }

I see no for, nor no while.  This should optimize down.

> Branko Cibej <branko.cibej@hermes.si>,

His example was mistaken.  He had no ``empty'' loops.

                for (size_t i = 0; i < size; ++i)
                    new (&objs[i]) T(init);

In this case, ``new (&objs[i]) T(init)'' != ``'', hence the loop is
not empty.

    for (size_t i = 0; i < size; ++i)
                    objs[i].~T();

In this case, ``objs[i].~T()'' != ``'', hence the loop is not empty.

This case should optimize down.

> Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> have provided
> examples that empty loops _should_ get removed.

His example was also mistaken:

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

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

I see no loops.  This should be optimized down.

The definition of loop means the use of the keyword ``for'' or
``while''. The definition of empty (in C and C++) means that textually
in the users source program, the character ';' follows the ')' from
the loop syntax.

I know, somewhat arbitrary, but prefectly clear.  This was the result
of the conversation from eons ago that we had.  It is not currently
implemented this way, but as I said, that is a bug in the
implementation, that can be fixed, if someone cares.

> Jeff, what happened to my patch? You neither commented on it nor has
> it been installed. :-(

I don't think it should be.


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