This is the mail archive of the gcc-bugs@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: G++ bug?


> >>>>> Toshiyasu Morita <tm@netcom.com> writes:

> > void main()
> > {
> >         MyClass Instance;

> >         MyClassFuncPtr FuncPtr1 = &MyClass::A;
> >         (Instance.*FuncPtr1)();
> > }

> > When compiled as "gcc -O2 -S test.cpp" it generates a *huge* amount of
> > code for some reason

:-) If you can find a way to optimize it, please teach the optimizer
to optimize it.  I don't know if we preserve enough information for a
non-buggy (easily fixable?) optimizer to optimize it.  If not, then we
can reanalyze it, and find a suitable tree form for it, or a way to 
remit it so the optimizer can crank it down.

In general I depend upon the optimizer to handle cases like:

   a = 1;
   b = a;
   foo(b);

reasonably well.  I tried this, and it optimizes well.  I think there
may be a SAVE_EXPR that might be causing it to not to a value
propagation, though this is to prevent a complex expression from being
evaluated twice.

I tried some straight C code, and it optimized well, so it should be
possible to improve codegen, if we just improve the trees some.


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