http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55683



--- Comment #15 from Martin Jambor <jamborm at gcc dot gnu.org> 2013-01-10 
16:58:35 UTC ---

(In reply to comment #13)

> The acutal ICE should be fixed.  Martinj, I will leave the PR open

> just to make you to double check that ipa-cp is doing properly the

> translation from constants to binfos, too.



At -O2, IPA-CP does not even consider cloning C::c1 because it is not

allowed to grow code by creating clones.



At -O3 (or with -fipa-cp-clone), IPA-CP discovers that cloning for &c

would lead to devirtualization but because the target of the

devirtualized call is not analyzed, it gets only minimal bonus for

that.  Eventually the cloning opportunity gets score 437 (cloning

threshold is 500) and thus it is dropped.  This is as it should be.



> I would expect this testcase to be caught by ipa-cp prior inlining. Also I

> think that when merging values, we should go from constant to binfo when

> constants differs but their binfos match (so when method is called with

> multiple static instances of the same object we will get devirtualization).  I

> don't see ipa-cp doing that.



Well, the problem with that of course is that we do not merge stuff

now, we accumulate all possible constants.  So what we perhaps should

do instead is (if ipcp_param_lattices->virt_call is true) to try to

see if a number of ADDR_EXPR constants yield the same binfo and if so,

consider that new value first, before any real constants.

Reply via email to