This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Restore cross-language inlining into Ada
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Jan 2016 13:33:22 +0100
- Subject: Re: [patch] Restore cross-language inlining into Ada
- Authentication-results: sourceware.org; auth=none
- References: <9690839 dot xiTXAUyZ0b at polaris> <CAFiYyc3r0-3hTfB92huJ48C=yGosMFaPuXyg170_H5ZBZWEUbA at mail dot gmail dot com> <20160121141352 dot GB12209 at atrey dot karlin dot mff dot cuni dot cz> <1712344 dot lljgTvaZVQ at polaris> <20160122120036 dot GB98233 at kam dot mff dot cuni dot cz>
On Fri, Jan 22, 2016 at 1:00 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> > I only updated
>> > - /* Don't inline if the callee can throw non-call exceptions but the
>> > - caller cannot.
>> > - FIXME: this is obviously wrong for LTO where STRUCT_FUNCTION is
>> > missing. - Move the flag into cgraph node or mirror it in the inline
>> > summary. */ - else if (callee_fun &&
>> > callee_fun->can_throw_non_call_exceptions - && !(caller_fun &&
>> > caller_fun->can_throw_non_call_exceptions)) - {
>> > - e->inline_failed = CIF_NON_CALL_EXCEPTIONS;
>> > - inlinable = false;
>> > - }
>> > to actually work with LTO where callee_fun/caller_fun is not always
>> > available (but sometimes, like when ICF requested the body or when we
>> > merged profiles, it is).
>>
>> No, that's not true. Let's consider an Ada caller and a C callee. With the
>> old code (mine as you remarked): caller_fun->can_throw_non_call_exceptions is
>> true and callee_fun->can_throw_non_call_exceptions is false, so the above test
>> is false and we can inline. With the new code (yours): check_match is true
>> and opt_for_fn (callee->decl, flag_non_call_exceptions) is false, so we cannot
>> inline.
>
> Hmm, I see now. I wonder if we can also inline can_thorw_non_call_exceptions
> to !can_throw_non_call_exceptions provied that we set the flag in
> ipa-inline-transform. That way we can inline Ada to C and the observation
> about no EH regions should still hold.
That might work (same for -fexceptions). You might want to wrap the function
in a ERT_MUST_NOT_THROW though in that case.
Richard.
> Honza
>>
>> --
>> Eric Botcazou