Make ipa-icf to not prevent devirtualization

Jan Hubicka
Fri Jan 15 11:41:00 GMT 2016

> On Fri, Jan 15, 2016 at 12:01 PM, Jan Hubicka <> wrote:
> > Hi,
> > this patch avoid ipa-icf to take away body of a virtual function which is a subject
> > of later devirtualization.
> But isn't can_remove_if_no_direct_alls_p () supposed to return false
> then?  (depending
> on cgraph state)

No, can_remove_if_no_direct_calls_p returns true if you can remove the body after
you eliminate all calls (as the name is supposed to suggest).

For the virtual function in question this is satisfied, but unfortunately in ICF
case makes us to miss optimization for no very good reason.  it is indeed quite bit
more subtle than I would like to.  Changing the predicate itself will however make
inliner to inline those functions less agressively which is not very desired either.


More information about the Gcc-patches mailing list