On 05/10/2013 11:27 AM, Martin Jambor wrote:
Hi,

as we discover targets of previously indirect calls in ipa-inline and
ipa-cp, we sometimes figure out that the targets are not a function.
One typical example is when NULL is passed as a function pointer
parameter, another is when C++ member-pointer points to a virtual
function and the overloaded field of the structure which can also hold
pointers to non-virtual methods contains odd integer constants.

I have gone through all the cases when this happens when LTO building
Mozilla Firefox and verified all of them were OK and legal.  Because
no such call to a non-function can ever occur in a legal program, I
have decided to turn them into calls of builting_unreachable, which
then could help further optimizations.

Because calls to builtin_unreachable is not cgraph_maybe_hot_edge_p,
whereas an indirect call with an unknown destination is, this change
often triggered assertion tree-ipa-inline-transform.c:263.  I have
discussed this with Honza and he has agreed to switch the check off
when there are newly discovered direct edges.

The patch has passed bootstrap and is undergoing testing now.  OK for
trunk if it passes?

Thanks,

Martin


2013-05-09  Martin Jambor  <mjam...@suse.cz>

        * ipa-prop.c (ipa_make_edge_direct_to_target): Redirect calls to
        non-functions to builtin_unreachable.
        * ipa-inline-transform.c (inline_call): Do not assert estimates were
        correct when new direct edges were discovered.
This is good.  Please install.

Thanks,
Jeff

Reply via email to