From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 11E463857829; Fri, 26 Mar 2021 08:21:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11E463857829 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95622] [11 Regression] force_output flag on a variable prevents optimization / regresses c-c++-common/goacc/kernels-alias-ipa-pta{-2,-4,}.c Date: Fri, 26 Mar 2021 08:21:06 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: deferred, missed-optimization, openacc, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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: Fri, 26 Mar 2021 08:21:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95622 --- Comment #9 from rguenther at suse dot de --- On Thu, 25 Mar 2021, burnus at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95622 >=20 > --- Comment #8 from Tobias Burnus --- > I am not sure whether this is a sensible solution, but it fixes > the issue for c-c++-common/goacc/kernels-alias-ipa-pta-2.c ... >=20 >=20 > diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c > index 529ec3a5b80..c93e9b46d8d 100644 > --- a/gcc/tree-ssa-structalias.c > +++ b/gcc/tree-ssa-structalias.c > @@ -8132,7 +8132,7 @@ refered_from_nonlocal_fn (struct cgraph_node *node,= void > *data) > *nonlocal_p |=3D (node->used_from_other_partition > || DECL_EXTERNAL (node->decl) > || TREE_PUBLIC (node->decl) > - || node->force_output > + || (node->force_output && !node->offloadable) > || lookup_attribute ("noipa", DECL_ATTRIBUTES (node->de= cl))); > return false; > } > @@ -8195,7 +8195,7 @@ ipa_pta_execute (void) > bool nonlocal_p =3D (node->used_from_other_partition > || DECL_EXTERNAL (node->decl) > || TREE_PUBLIC (node->decl) > - || node->force_output > + || (node->force_output && !node->offloadable) > || lookup_attribute ("noipa", > DECL_ATTRIBUTES (node->decl= ))); > node->call_for_symbol_thunks_and_aliases (refered_from_nonlocal_fn, It's for sure incorrect since node->force_output could be set for other reasons. But of course the reason for the node->force_output check is that it is set by __attribute__((used)) which means a function/variable can be invoked/accessed by means not visible to the compiler. As said elsewhere the "fix" is to make the offload reference visible to IPA early enough.=