This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: New ipa-devirt PATCH for c++/58678 (devirt vs. KDE)
- From: Jason Merrill <jason at redhat dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 05 Mar 2014 14:41:42 -0500
- Subject: Re: RFA: New ipa-devirt PATCH for c++/58678 (devirt vs. KDE)
- Authentication-results: sourceware.org; auth=none
- References: <53175C86 dot 8020806 at redhat dot com> <20140305184005 dot GA9238 at kam dot mff dot cuni dot cz>
On 03/05/2014 01:40 PM, Jan Hubicka wrote:
I think the abstract classes probably should never be considered in the type
inheritance graph walk as possible instances. That is we probably want to test
them in record_targets_from_bases, possible_polymorphic_call_targets and
record_target_from_binfo and simply never call maybe_record_node when the type
considered is abstract without concluding that list is incomplete as we do when
method can not be referred. If the type has derivations that do not override
something, we will record the methods when walking derived type, so i do not
think we need to make difference in between destructor and other type.
Hmm, if we see
struct A
{
virtual void f() = 0;
virtual void g() { };
};
void f(A* a)
{
a->g();
}
and ignore A because it's abstract, then we don't speculatively
devirtualize the call to g, which we might want to do; it might be the
case that most derived classes don't override g. The destructor is
special because all derived classes must override it.
I can prepare patch tomorrow if you prefer, thanks for looking into this!
Sounds good, thanks.
Jason