This is the mail archive of the
mailing list for the GCC project.
vtable optimization (was Re: TREE_UNCHANGING?)
Another tangent: if we know the static type of the object, we can do even
better: we can skip the vtable lookup entirely and call the function
directly. There is some simple code in the C++ frontend to handle this,
mostly in fixed_type_or_null; a more C++-aware optimizer could track the
static type information as well as the alias set, so that we could perform
this optimization for code like
A *ap = &a;
as well as the simpler
This stuff is probably better suited for an AST-level optimization pass.