PATCH: PR 29487

amylaar@spamcop.net amylaar@spamcop.net
Wed Feb 7 11:10:00 GMT 2007


Quoting Mark Mitchell <mark@codesourcery.com>:

> I have attacked the problem by first adding a macro DECL_REPLACEABLE_P
> which is true iff a function may be replaced at link-time with a
> functionally different definition.  This macro is like binds_local_p
> -- but more agressive; while a COMDAT function is not binds_local_p,
> it is also not DECL_REPLACEABLE_P.  The macro is used in the several
> places in the compiler that have been identified as gating the setting
> of TREE_NOTHROW.

That makes sense to me.  However, for consistency (and run-time performance),
in mainline, this macro should also be used in
ipa-pure-const.c:analyze_function to replace the direct
targetm.binds_local_p check.

> I did not attempt to fix the other problem from PR 29487, which is
> that weak functions which do not throw exceptions are now emitted with
> exception unwind information.  That problem stems from the dual use of
> TREE_NOTHROW.  Because TREE_NOTHROW is used to indicate to the
> optimizers that a function does not throw, setting it for a
> replaceable function might confuse them.  But, TREE_NOTHROW is also
> used to determine whether or not unwind information should be emitted
> for a function.  I think that we don't really need a separate bit: we
> just need the optimizers to check "TREE_NOTHROW (callee) &&
> !DECL_REPLACEABLE (callee)"

I disagree.  Such a change will make the compiler assume that replaceble
functions can throw, even when a user-provided prototype says otherwise.



More information about the Gcc-patches mailing list