public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-24 22:10 ` cvs-commit at gcc dot gnu.org
  2020-04-24 22:25 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-24 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:cf39dccf9284d2fd9f9aa7050760adea110c8d88

commit r10-7952-gcf39dccf9284d2fd9f9aa7050760adea110c8d88
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 25 00:10:01 2020 +0200

    cselim: Don't assume it is safe to cstore replace a store to a local
variable with unknown offset [PR94734]

    As the new testcase shows, it is not safe to assume we can optimize
    a conditional store into an automatic non-addressable var, we can do it
    only if we can prove that the unconditional load or store actually will
    not be outside of the boundaries of the variable.
    If the offset and size are constant, we can, but this is already all
    checked in !tree_could_trap_p, otherwise we really need to check for
    a dominating unconditional store, or for the specific case of automatic
    non-addressable variables, it is enough if there is a dominating load
    (that is what those 4 testcases have).  tree-ssa-phiopt.c has some
    infrastructure for this already, see the add_or_mark_expr method etc.,
    but right now it handles only MEM_REFs with SSA_NAME first operand
    and some integral offset.  So, I think it can be for GCC11 extended
    to handle other memory references, possibly up to just doing
    get_inner_reference and hasing based on the base, offset expressions
    and bit_offset and bit_size, and have also a special case that for
    !TREE_ADDRESSABLE automatic variables it could ignore whether something
    is a load or store because the local stack should be always writable.
    But it feels way too dangerous to do this this late for GCC10, so this
    patch just restricts the optimization to the safe case (where lhs doesn't
    trap), and on Richi's request also ignores TREE_ADDRESSABLE bit if
    flag_store_data_races, because my understanding the reason for
    TREE_ADDRESSABLE check is that we want to avoid introducing
    store data races (if address of an automatic var escapes, some other thread
    could be accessing it concurrently).

    2020-04-25  Jakub Jelinek  <jakub@redhat.com>
                Richard Biener  <rguenther@suse.de>

            PR tree-optimization/94734
            PR tree-optimization/89430
            * tree-ssa-phiopt.c: Include tree-eh.h.
            (cond_store_replacement): Return false if an automatic variable
            access could trap.  If -fstore-data-races, don't return false
            just because an automatic variable is addressable.

            * gcc.dg/tree-ssa/pr89430-1.c: Add xfail.
            * gcc.dg/tree-ssa/pr89430-2.c: Add xfail.
            * gcc.dg/tree-ssa/pr89430-5.c: Add xfail.
            * gcc.dg/tree-ssa/pr89430-6.c: Add xfail.
            * gcc.c-torture/execute/pr94734.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
  2020-04-24 22:10 ` [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel cvs-commit at gcc dot gnu.org
@ 2020-04-24 22:25 ` jakub at gcc dot gnu.org
  2020-04-28  9:59 ` tnfchris at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-24 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
                 CC|                            |jakub at gcc dot gnu.org
             Status|RESOLVED                    |REOPENED

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The testcases for which this has been filed are no longer optimized, that needs
more work for GCC11.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
  2020-04-24 22:10 ` [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel cvs-commit at gcc dot gnu.org
  2020-04-24 22:25 ` jakub at gcc dot gnu.org
@ 2020-04-28  9:59 ` tnfchris at gcc dot gnu.org
  2020-06-04  9:08 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2020-04-28  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org

--- Comment #14 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Indeed, we should revisit this for GCC 11 as the partial revert has caused a 5%
regression in leela.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-04-28  9:59 ` tnfchris at gcc dot gnu.org
@ 2020-06-04  9:08 ` cvs-commit at gcc dot gnu.org
  2022-11-11  8:47 ` tnfchris at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hao Liu <hliu@gcc.gnu.org>:

https://gcc.gnu.org/g:54ecfb182bc32140722022c1d9818dee4bdc0e45

commit r11-897-g54ecfb182bc32140722022c1d9818dee4bdc0e45
Author: Hao Liu <hliu@os.amperecomputing.com>
Date:   Thu Jun 4 16:28:37 2020 +0800

    cselim: Extend to check non-trapping for more references [PR89430]

    If there is a dominating store, a store to the same reference can not be
    trapped.  But previously, it only supports such check on MEM_REFs.
    So this patch extends it to support ARRAY_REFs and COMPONENT_REFs.

    This patch also supports a special case: if there is a dominating load of
    local variable without address escape, a store is not trapped, as local
    stack is always writable.  Other loads are ignored for simplicity, as they
    don't help to check if a store can be trapped (the memory may be
read-only).

    gcc/ChangeLog:

            PR tree-optimization/89430
            * tree-ssa-phiopt.c
            (struct name_to_bb): Rename to ref_to_bb; add a new field exp;
            remove ssa_name_ver, store, offset fields.
            (struct ssa_names_hasher): Rename to refs_hasher; update functions.
            (class nontrapping_dom_walker): Rename m_seen_ssa_names to
m_seen_refs.
            (nontrapping_dom_walker::add_or_mark_expr): Extend to support
ARRAY_REFs
            and COMPONENT_REFs.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/89430
            * gcc.dg/tree-ssa/pr89430-1.c: Remove xfail.
            * gcc.dg/tree-ssa/pr89430-2.c: Remove xfail.
            * gcc.dg/tree-ssa/pr89430-5.c: Remove xfail.
            * gcc.dg/tree-ssa/pr89430-6.c: Remove xfail.
            * gcc.dg/tree-ssa/pr89430-7-comp-ref.c: New test.
            * gcc.dg/tree-ssa/pr89430-8-mem-ref-size.c: New test.
            * gcc.dg/tree-ssa/ssa-pre-17.c: Add -fno-tree-cselim.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-06-04  9:08 ` cvs-commit at gcc dot gnu.org
@ 2022-11-11  8:47 ` tnfchris at gcc dot gnu.org
  2022-11-11  8:53 ` jiangning.liu at amperecomputing dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2022-11-11  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
I think this can be closed now right?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-11-11  8:47 ` tnfchris at gcc dot gnu.org
@ 2022-11-11  8:53 ` jiangning.liu at amperecomputing dot com
  2022-11-11  9:32 ` tnfchris at gcc dot gnu.org
  2022-11-28 22:18 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: jiangning.liu at amperecomputing dot com @ 2022-11-11  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jiangning Liu <jiangning.liu at amperecomputing dot com> ---
Yes.

> -----Original Message-----
> From: tnfchris at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> Sent: Friday, November 11, 2022 4:48 PM
> To: JiangNing Liu <jiangning.liu@amperecomputing.com>
> Subject: [Bug tree-optimization/89430] A missing ifcvt optimization to
> generate csel
> 
> [EXTERNAL EMAIL NOTICE: This email originated from an external sender.
> Please be mindful of safe email handling and proprietary information
> protection practices.]
> 
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89430
> 
> --- Comment #16 from Tamar Christina <tnfchris at gcc dot gnu.org> --- I
> think this can be closed now right?
> 
> --
> You are receiving this mail because:
> You reported the bug.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-11-11  8:53 ` jiangning.liu at amperecomputing dot com
@ 2022-11-11  9:32 ` tnfchris at gcc dot gnu.org
  2022-11-28 22:18 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: tnfchris at gcc dot gnu.org @ 2022-11-11  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #18 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Fixed in GCC 11

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel
       [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-11-11  9:32 ` tnfchris at gcc dot gnu.org
@ 2022-11-28 22:18 ` pinskia at gcc dot gnu.org
  7 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-28 22:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89430-4@http.gcc.gnu.org/bugzilla/>
2020-04-24 22:10 ` [Bug tree-optimization/89430] A missing ifcvt optimization to generate csel cvs-commit at gcc dot gnu.org
2020-04-24 22:25 ` jakub at gcc dot gnu.org
2020-04-28  9:59 ` tnfchris at gcc dot gnu.org
2020-06-04  9:08 ` cvs-commit at gcc dot gnu.org
2022-11-11  8:47 ` tnfchris at gcc dot gnu.org
2022-11-11  8:53 ` jiangning.liu at amperecomputing dot com
2022-11-11  9:32 ` tnfchris at gcc dot gnu.org
2022-11-28 22:18 ` pinskia at gcc dot gnu.org

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).