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/114121] wrong code with _BitInt() arithmetics at -O2
Date: Wed, 28 Feb 2024 14:03:45 +0000	[thread overview]
Message-ID: <bug-114121-4-XHpTbiTJDi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114121-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #15 from GCC 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:c841144a94363ff26e40ab3f26b14702c32987a8

commit r14-9215-gc841144a94363ff26e40ab3f26b14702c32987a8
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Feb 28 12:37:07 2024 +0100

    tree-optimization/114121 - wrong VN with context sensitive range info

    When VN ends up exploiting range-info specifying the ao_ref offset
    and max_size we have to make sure to reflect this in the hashtable
    entry for the recorded expression.  The PR113831 fix handled the
    case where we can encode this in the operands themselves but this
    bug shows the issue is more widespread.

    So instead of altering the operands the following instead records
    this extra info that's possibly used, only throwing it away when
    the value-numbering didn't come up with a non-VARYING value which
    is an important detail to preserve CSE as opposed to constant
    folding which is where all cases currently known popped up.

    With this the original PR113831 fix can be reverted.

            PR tree-optimization/114121
            * tree-ssa-sccvn.h (vn_reference_s::offset,
            vn_reference_s::max_size): New fields.
            (vn_reference_insert_pieces): Adjust prototype.
            * tree-ssa-pre.cc (phi_translate_1): Preserve offset/max_size.
            * tree-ssa-sccvn.cc (vn_reference_eq): Compare offset and
            size, allow using "don't know" state.
            (vn_walk_cb_data::finish): Pass along offset/max_size.
            (vn_reference_lookup_or_insert_for_pieces): Take offset and
            max_size as argument and use it.
            (vn_reference_lookup_3): Properly adjust offset and max_size
            according to the adjusted ao_ref.
            (vn_reference_lookup_pieces): Initialize offset and max_size.
            (vn_reference_lookup): Likewise.
            (vn_reference_lookup_call): Likewise.
            (vn_reference_insert): Likewise.
            (visit_reference_op_call): Likewise.
            (vn_reference_insert_pieces): Take offset and max_size
            as argument and use it.

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

  parent reply	other threads:[~2024-02-28 14:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 18:30 [Bug tree-optimization/114121] New: " zsojka at seznam dot cz
2024-02-26 18:36 ` [Bug tree-optimization/114121] " pinskia at gcc dot gnu.org
2024-02-26 18:42 ` pinskia at gcc dot gnu.org
2024-02-26 18:50 ` jakub at gcc dot gnu.org
2024-02-26 18:58 ` jakub at gcc dot gnu.org
2024-02-26 19:10 ` jakub at gcc dot gnu.org
2024-02-26 19:43 ` jakub at gcc dot gnu.org
2024-02-27  8:26 ` rguenth at gcc dot gnu.org
2024-02-27 10:48 ` rguenth at gcc dot gnu.org
2024-02-27 12:29 ` rguenth at gcc dot gnu.org
2024-02-27 12:40 ` jakub at gcc dot gnu.org
2024-02-27 12:41 ` jakub at gcc dot gnu.org
2024-02-27 13:54 ` rguenth at gcc dot gnu.org
2024-02-27 14:19 ` rguenth at gcc dot gnu.org
2024-02-27 15:43 ` jakub at gcc dot gnu.org
2024-02-28 14:03 ` cvs-commit at gcc dot gnu.org [this message]
2024-02-28 14:04 ` rguenth at gcc dot gnu.org
2024-02-28 23:13 ` pinskia at gcc dot gnu.org
2024-03-12 14:16 ` cvs-commit at gcc dot gnu.org
2024-05-07  6:18 ` cvs-commit 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-114121-4-XHpTbiTJDi@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).