This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: RFA: New ipa-devirt PATCH for c++/58678 (devirt vs. KDE)


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


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