------- Comment #3 from hubicka at gcc dot gnu dot org  2010-09-16 17:36 -------
Hmm, the problem is that foo is virtual self recursive function.
We inline it and then indirect inlining decide that it can devirtualize the
self recursive call since it knows the operand has proper type.
At that time we already removed the function from callgraph since all direct
calls was resolved, it is COMDAT and corresponding vtable is elsehwere.

We have options:
 1) Prevent devirtualization in this case
 2) Special case COMDAT virtual functions in inliner and prevent them from
being removed early
 3) Make inliner to re-invent nodes for those functions.

All solutions are sort of wrong.  I am leaning towards 2) with extra code
keeping virtual COMDAT till inlining stage (similarly as we do with extern
inlines) so possible indirect calls can be resolved.
Will give this a try.

Proper solution here is probably introduction of may edges...

Martin: Can we devirtualize the recursive call always based on fact that we go
to the function so it got to be of proper type?




Reply via email to