public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tschwinge at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-95622-4-jPRaxv47yu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95622-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95622

Thomas Schwinge <tschwinge at gcc dot gnu.org> 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.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-12

--- Comment #2 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(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 errors)
    [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-2.c
scan-tree-dump-times optimized "(?n)= 0;$" 2
    PASS: c-c++-common/goacc/kernels-alias-ipa-pta-2.c scan-tree-dump-times
optimized "(?n)= 1;$" 1
    PASS: c-c++-common/goacc/kernels-alias-ipa-pta-2.c scan-tree-dump-times
optimized "(?n)= \\*a" 0

    PASS: c-c++-common/goacc/kernels-alias-ipa-pta-4.c (test for excess errors)
    [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-4.c
scan-tree-dump-times optimized "(?n)= 0;$" 2
    PASS: c-c++-common/goacc/kernels-alias-ipa-pta-4.c scan-tree-dump-times
optimized "(?n)= 1;$" 1
    [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta-4.c
scan-tree-dump-times optimized "(?n)= \\*_[0-9];$" 0

    PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c (test for excess errors)
    [-PASS:-]{+FAIL:+} c-c++-common/goacc/kernels-alias-ipa-pta.c
scan-tree-dump-times optimized "(?n)= 0;$" 2
    PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c scan-tree-dump-times
optimized "(?n)= 1;$" 1
    PASS: c-c++-common/goacc/kernels-alias-ipa-pta.c scan-tree-dump-times
optimized "(?n)= \\*_[0-9]\\[0\\];$" 0

Same for C++.

Thus: "[11 Regression] force_output flag on a variable prevents optimization  /
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 it'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 true".

> Somewhat similar to PR 68773.
> 
> The testcase: c-c++-common/goacc/kernels-alias-ipa-pta-2.c
> …
>   {
>     a[0] = 0;
>     b[0] = 1;
>     c[0] = a[0];
>   }
> …
> 
> Without ENABLE_OFFLOAD or before
> r11-1075-g1c0fdaf79e3618fd7512608a2e5c62b6b306e9e8 (for PR94848 + PR95551):
> 
>   MEM[(unsigned int *)_5] = 0;  // a[0] = 0
>   MEM[(unsigned int *)_4] = 1;  // b[0] = 1
>   MEM[(unsigned int *)_3] = 0;  // c[0] = a[0]
> 
> With r11-1075 + offloading compiler, force_output is on offloading variables
> (to ensure they are not optimized away), the last line becomes
> 
>   _8 = MEM[(unsigned int *)_5];  // _8 = a[0]
>   MEM[(unsigned int *)_3] = _8;  // c[0] = _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".)
> 
> [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 "{ }"…]

That's PR90591 etc.?

  parent reply	other threads:[~2020-06-12 10:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10  9:08 [Bug middle-end/95622] New: force_output flag on a variable prevents optimization / regresses c-c++-common/goacc/kernels-alias-ipa-pta-2.c burnus at gcc dot gnu.org
2020-06-10  9:18 ` [Bug middle-end/95622] " jakub at gcc dot gnu.org
2020-06-12 10:58 ` tschwinge at gcc dot gnu.org [this message]
2020-06-12 13:10 ` [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 burnus at gcc dot gnu.org
2020-06-16 13:15 ` cvs-commit at gcc dot gnu.org
2020-06-16 13:22 ` cvs-commit at gcc dot gnu.org
2020-07-15  6:56 ` rguenth at gcc dot gnu.org
2020-07-15  7:06 ` burnus at gcc dot gnu.org
2021-01-14  9:00 ` rguenth at gcc dot gnu.org
2021-03-25 18:28 ` burnus at gcc dot gnu.org
2021-03-26  8:21 ` rguenther at suse dot de
2021-04-27 11:39 ` [Bug middle-end/95622] [11/12 " jakub at gcc dot gnu.org
2021-07-28  7:04 ` rguenth at gcc dot gnu.org
2022-04-21  7:48 ` rguenth at gcc dot gnu.org
2023-05-29 10:02 ` [Bug middle-end/95622] [11/12/13/14 " jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95622-4-jPRaxv47yu@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).