From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A6CEF3858405; Wed, 25 Aug 2021 13:44:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6CEF3858405 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/102059] Incorrect always_inline diagnostic in LTO mode with #pragma GCC target("cpu=power10") Date: Wed, 25 Aug 2021 13:44:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: diagnostic, lto, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2021 13:44:55 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102059 Martin Li=C5=A1ka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |meissner at linux dot ibm.= com --- Comment #7 from Martin Li=C5=A1ka --- About the non-LTO mode, the rs6000_can_inline_p succeeds due to: /* If the callee has no option attributes, then it is ok to inline. */ if (!callee_tree) ret =3D true; This is not correct in my opinion, please see i386.c: static bool ix86_can_inline_p (tree caller, tree callee) { ... if (!callee_tree) callee_tree =3D target_option_default_node; if (!caller_tree) caller_tree =3D target_option_default_node; ... So I think the following should be applied: diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e073b26b430..4a997b0cabc 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -25036,9 +25036,8 @@ rs6000_can_inline_p (tree caller, tree callee) tree caller_tree =3D DECL_FUNCTION_SPECIFIC_TARGET (caller); tree callee_tree =3D DECL_FUNCTION_SPECIFIC_TARGET (callee); - /* If the callee has no option attributes, then it is ok to inline. */ if (!callee_tree) - ret =3D true; + callee_tree =3D target_option_default_node; else {=