From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BE43395A81D; Fri, 12 Jun 2020 13:10:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BE43395A81D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591967408; bh=HgEjflyz5E0dLXsO3+gRRKlhoemc0p4K7i9A8ZliPDw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bg8jlTFZVDiq1avz+6Omi9ATFfJPD9G3TDqh/zolOykYXYFwob5NccnUanuJg3Sue t1KBNG17K53PcLXpA/BEuD1bym5w4BNTi/A7J7qj0Rd/6QMnjigiL7pCb/TH2Eb6hE grcZUxJLRJwE4t9ryEiouPhJuNIR0AJBEGxX2674= From: "burnus at gcc dot gnu.org" 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, 12 Jun 2020 13:10:08 +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: 10.0 X-Bugzilla-Keywords: missed-optimization, openacc, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus 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: 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, 12 Jun 2020 13:10:08 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95622 --- Comment #3 from Tobias Burnus --- I think there are three related issues here: (a) force_output =3D 1 prevents at least one optimization (b) If not using force_output =3D 1, we need to find another way to tell the compiler that the variable is actually needed =E2=80=93 even if unused. (cf. comment 1) (c) There are missed optimizations related to offloading =E2=80=93 both before streaming-out the offload table and afterward. * * * (See also PR 92029 for another test case fixed =E2=80=93 but I think we can= not learn much from that one as there the optimization happens before the stream out.) (In reply to Thomas Schwinge from comment #2) > We'll need to analyze if we need to restore that functionality now, or if > it's OK to lose that optimization. Fixing "now" is only possible by reverting the patch. But given that the pa= tch fixes a wrong code generation (link errors or ICE) and comes after the first optimizations have been done (before LTO streamout), I would not undo it. = =E2=80=93 Hence: not fixing now but the more optimizations the better :-) [In particular, my impression is that artificial, read-only static variable= s do not need to be linked between host and device as one cannot really take the= ir address and they cannot be updated or changed.]=