public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103037] [11/12 Regression] Wrong code with -O2 since r11-6100-gd41b097350d3c5d0
Date: Fri, 25 Feb 2022 12:21:01 +0000	[thread overview]
Message-ID: <bug-103037-4-ZjUW6qZ7AY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103037-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r12-7389-ge25dce501334053239dcc433e4c46ecbddbcb13e
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Feb 24 13:04:29 2022 +0100

    tree-optimization/103037 - PRE simplifying valueized expressions

    This fixes a long-standing issue in PRE where we track valueized
    expressions in our expression sets that we use for PHI translation,
    code insertion but also feed into match-and-simplify via
    vn_nary_simplify.  But that's not what is expected from vn_nary_simplify
    or match-and-simplify which assume we are simplifying with operands
    available at the point of the expression so they can use contextual
    information on the SSA names like ranges.  While the VN side was
    updated to ensure this with the rewrite to RPO VN, thereby removing
    all workarounds that nullified such contextual info on all SSA names,
    the PRE side still suffers from this.

    The following patch tries to apply minimal surgery at this point
    and makes PRE track un-valueized expressions in the expression sets
    but only for the NARY kind (both NAME and CONSTANT do not suffer
    from this issue), leaving the REFERENCE kind alone.  The REFERENCE
    kind is important when trying to remove the workarounds still in
    place in compute_avail for code hoisting, but that's a separate issue
    and we have a working workaround in place.

    Doing this comes at the cost of duplicating the VN IL on the PRE side
    for NARY and eventually some extra overhead for translated expressions
    that is difficult to assess.

    2022-02-25  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/103037
            * tree-ssa-sccvn.h (alloc_vn_nary_op_noinit): Declare.
            (vn_nary_length_from_stmt): Likewise.
            (init_vn_nary_op_from_stmt): Likewise.
            (vn_nary_op_compute_hash): Likewise.
            * tree-ssa-sccvn.cc (alloc_vn_nary_op_noinit): Export.
            (vn_nary_length_from_stmt): Likewise.
            (init_vn_nary_op_from_stmt): Likewise.
            (vn_nary_op_compute_hash): Likewise.
            * tree-ssa-pre.cc (pre_expr_obstack): New obstack.
            (get_or_alloc_expr_for_nary): Pass in the value-id to use,
            (re-)compute the hash value and if the expression is not
            found allocate it from pre_expr_obstack.
            (phi_translate_1): Do not insert the NARY found in the
            VN tables but build a PRE expression from the valueized
            NARY with the value-id we eventually found.
            (find_or_generate_expression): Assert we have an entry
            for constant values.
            (compute_avail): Insert not valueized expressions into
            EXP_GEN using the value-id from the VN tables.
            (init_pre): Allocate pre_expr_obstack.
            (fini_pre): Free pre_expr_obstack.

            * gcc.dg/torture/pr103037.c: New testcase.

  parent reply	other threads:[~2022-02-25 12:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02  7:17 [Bug tree-optimization/103037] New: [11/12 Regression] Wrong code with -O2 vsevolod.livinskij at frtk dot ru
2021-11-02  7:36 ` [Bug tree-optimization/103037] [11/12 Regression] Wrong code with -O2 since r11-6100-gd41b097350d3c5d0 marxin at gcc dot gnu.org
2021-11-02  7:52 ` pinskia at gcc dot gnu.org
2021-11-02  8:43 ` rguenth at gcc dot gnu.org
2021-11-02  8:51 ` jakub at gcc dot gnu.org
2021-11-02  9:08 ` jakub at gcc dot gnu.org
2021-11-02 14:18 ` rguenther at suse dot de
2021-11-03 10:08 ` rguenth at gcc dot gnu.org
2021-11-05 13:39 ` rguenth at gcc dot gnu.org
2022-02-23 15:25 ` rguenth at gcc dot gnu.org
2022-02-25 12:21 ` cvs-commit at gcc dot gnu.org [this message]
2022-02-25 12:21 ` [Bug tree-optimization/103037] [11 " rguenth at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` 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-103037-4-ZjUW6qZ7AY@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).