From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1461 invoked by alias); 21 Jan 2016 14:13:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 1448 invoked by uid 89); 21 Jan 2016 14:13:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=ebotcazouadacorecom, ebotcazou@adacore.com X-HELO: atrey.karlin.mff.cuni.cz Received: from atrey.karlin.mff.cuni.cz (HELO atrey.karlin.mff.cuni.cz) (195.113.26.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Jan 2016 14:13:55 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id B5C1F8236C; Thu, 21 Jan 2016 15:13:52 +0100 (CET) Date: Thu, 21 Jan 2016 14:13:00 -0000 From: Jan Hubicka To: Richard Biener Cc: Eric Botcazou , GCC Patches Subject: Re: [patch] Restore cross-language inlining into Ada Message-ID: <20160121141352.GB12209@atrey.karlin.mff.cuni.cz> References: <9690839.xiTXAUyZ0b@polaris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg01629.txt.bz2 > On Wed, Jan 20, 2016 at 9:32 AM, Eric Botcazou wrote: > > Hi, > > > > this patch from Jan: > > https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01388.html > > totally disabled cross-language inlining into Ada without notice, by adding a > > check that always fails when the language of the callee is not Ada... > > The attached patch simply deletes this new check to restore the initial state. 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). > > > > Tested on x86_64-suse-linux, OK for the mainline? > > I think the intent was to allow inlining a non-throwing -fnon-call-exceptions > function into a not -fnon-call-exceptions function but _not_ a > non-throwing not -fnon-call-exceptions function (that "not-throwing" is > basically a non-sensible test) into a -fnon-call-exceptions function > because that may now miss EH edges. > > So the test looks conservatively correct to me - we can't reliably > check whether the callee throws if the IL now were -fnon-call-exceptions > (which we know the caller is after !opt_for_fn (callee->decl, > flag_non_call_exceptions) > > So - this doesn't look correct to me. > > OTOH > > static inline int foo (int a, int *b) > { > return a / *b; > } > > int __attribute__((optimize("non-call-exceptions"))) > bar (int *p, int *b) > { > try > { > return foo (*p, b); > } > catch (...) > { > return 0; > } > } > > happily inlines foo with your patch but doesn't ICE during stmt verification. > > So maybe we're not verifying that "correctness" part - ah, yeah, I think > we changed it to only verify EH tree vs. stmt consistency but not the > other way around. Well, it is a while since I looked deeper into EH code, but if I remember correctly we have EH region associated with statements and the non-call exceptions do not have EH region that is taken by EH code as an information that the statement was proved to not throw? In that case inlining could be safe, if the inlined statements are not placed in EH region (I think inliner does that) So perhaps this inlining is always safe? Honza