From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 73E243959C14; Fri, 12 Jun 2020 10:58:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73E243959C14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591959499; bh=ZsnxHXDF2va6QRtvPOXAdIqQLSmLVh06SQrI0EMLeq8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ln+8oVlQrHOWpXIUphszYG8kBWvIctBz2YyS7qWw8NV0pqqRtm6czTvUq1pZsWJEN Q3UdXxb6YCwiyGp6Ozsn64bLt1FJV/nslcdZmrF6JyJertHXCDetWkLCkPnyn82LF9 XPwl+58xw54BuobYwSTYdY516Rz2SrkMgQ79HVqw= From: "tschwinge 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 10:58:19 +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: tschwinge 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: short_desc cc bug_status everconfirmed cf_reconfirmed_on 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 10:58:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95622 Thomas Schwinge changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|force_output flag on a |[11 Regression] |variable prevents |force_output flag on a |optimization / regresses |variable prevents |c-c++-common/goacc/kernels- |optimization / regresses |alias-ipa-pta-2.c |c-c++-common/goacc/kernels- | |alias-ipa-pta{-2,-4,}.c CC| |tschwinge at gcc dot gnu.o= rg Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2020-06-12 --- Comment #2 from Thomas Schwinge --- (In reply to Tobias Burnus from comment #0) > The following Specifically: PASS: c-c++-common/goacc/kernels-alias-ipa-pta-2.c (test for excess err= ors) [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-2.c scan-tree-dump-times optimized "(?n)=3D 0;$" 2 PASS: c-c++-common/goacc/kernels-alias-ipa-pta-2.c scan-tree-dump-times optimized "(?n)=3D 1;$" 1 PASS: c-c++-common/goacc/kernels-alias-ipa-pta-2.c scan-tree-dump-times optimized "(?n)=3D \\*a" 0 PASS: c-c++-common/goacc/kernels-alias-ipa-pta-4.c (test for excess err= ors) [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-4.c scan-tree-dump-times optimized "(?n)=3D 0;$" 2 PASS: c-c++-common/goacc/kernels-alias-ipa-pta-4.c scan-tree-dump-times optimized "(?n)=3D 1;$" 1 [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-4.c scan-tree-dump-times optimized "(?n)=3D \\*_[0-9];$" 0 PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c (test for excess error= s) [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta.c scan-tree-dump-times optimized "(?n)=3D 0;$" 2 PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c scan-tree-dump-times optimized "(?n)=3D 1;$" 1 PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c scan-tree-dump-times optimized "(?n)=3D \\*_[0-9]\\[0\\];$" 0 Same for C++. Thus: "[11 Regression] force_output flag on a variable prevents optimizatio= n / regresses c-c++-common/goacc/kernels-alias-ipa-pta{-2,-4,}.c". We'll need to analyze if we need to restore that functionality now, or if i= t's OK to lose that optimization. > only shows up as FAIL in the testsuite if ENABLE_OFFLOAD is > true, even though it is only a compile-time test. [Hence, it can make > sense to not only "make check-target-libgomp" with an offloading compiler > but also gcc/.] Somewhat unfortunate, but yes. The test cases need to be XFAILed conditionally "if ENABLE_OFFLOAD is tru= e". > Somewhat similar to PR 68773. >=20 > The testcase: c-c++-common/goacc/kernels-alias-ipa-pta-2.c > =E2=80=A6 > { > a[0] =3D 0; > b[0] =3D 1; > c[0] =3D a[0]; > } > =E2=80=A6 >=20 > Without ENABLE_OFFLOAD or before > r11-1075-g1c0fdaf79e3618fd7512608a2e5c62b6b306e9e8 (for PR94848 + PR95551= ): >=20 > MEM[(unsigned int *)_5] =3D 0; // a[0] =3D 0 > MEM[(unsigned int *)_4] =3D 1; // b[0] =3D 1 > MEM[(unsigned int *)_3] =3D 0; // c[0] =3D a[0] >=20 > With r11-1075 + offloading compiler, force_output is on offloading variab= les > (to ensure they are not optimized away), the last line becomes >=20 > _8 =3D MEM[(unsigned int *)_5]; // _8 =3D a[0] > MEM[(unsigned int *)_3] =3D _8; // c[0] =3D _8 (... as is visible from the 'kernels-alias-ipa-pta-2.c.104t.fre3' dump onwards.) > Expected: force_output does not affect the optimization. (Especially as "= a" > cannot be optimized away as it is also used for "copyout".) >=20 > [A very well optimizing compiler could see that nothing uses a/b/c after = the > target section and could replace the whole function body by "{ }"=E2=80= =A6] That's PR90591 etc.?=