public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/113727] [14 Regression] csmith: differences from nothing to -O1 since r14-4612-g6decda1a35be57
Date: Tue, 19 Mar 2024 11:22:12 +0000	[thread overview]
Message-ID: <bug-113727-4-CHyrUsqYuM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113727-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #22 from Richard Biener <rguenth at gcc dot gnu.org> ---
Handling LHS sra_handled_bf_read_p the same as RHS also fixes the issue,
we then detect the partial overlap of the accesses without looking at
grp_partial_lhs.

I wonder if we run into the same issue for REAL/IMAGPART_EXPR on the LHS
when we have both _Complex and component accesses mixed.

So alternative patch:

diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc
index f8e71ec48b9..8e9c2e3d343 100644
--- a/gcc/tree-sra.cc
+++ b/gcc/tree-sra.cc
@@ -1161,7 +1161,7 @@ build_access_from_expr_1 (tree expr, gimple *stmt, bool
write)
   bool partial_ref;

   if ((TREE_CODE (expr) == BIT_FIELD_REF
-       && (write || !sra_handled_bf_read_p (expr)))
+       && !sra_handled_bf_read_p (expr))
       || TREE_CODE (expr) == IMAGPART_EXPR
       || TREE_CODE (expr) == REALPART_EXPR)
     {
@@ -3973,7 +3980,7 @@ sra_modify_expr (tree *expr, bool write,
gimple_stmt_iterator *stmt_gsi,
   bool partial_cplx_access = false;

   if (TREE_CODE (*expr) == BIT_FIELD_REF
-      && (write || !sra_handled_bf_read_p (*expr)))
+      && !sra_handled_bf_read_p (*expr))
     {
       bfr = *expr;
       expr = &TREE_OPERAND (*expr, 0);
@@ -4517,7 +4524,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator
*gsi)
   if (TREE_CODE (rhs) == REALPART_EXPR || TREE_CODE (lhs) == REALPART_EXPR
       || TREE_CODE (rhs) == IMAGPART_EXPR || TREE_CODE (lhs) == IMAGPART_EXPR
       || (TREE_CODE (rhs) == BIT_FIELD_REF && !sra_handled_bf_read_p (rhs))
-      || TREE_CODE (lhs) == BIT_FIELD_REF)
+      || (TREE_CODE (lhs) == BIT_FIELD_REF && !sra_handled_bf_read_p (lhs)))
     {
       modify_this_stmt = sra_modify_expr (gimple_assign_rhs1_ptr (stmt),
                                          false, gsi, gsi);

  parent reply	other threads:[~2024-03-19 11:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 19:40 [Bug c/113727] New: csmith: differences from nothing to -O1 dcb314 at hotmail dot com
2024-02-02 20:27 ` [Bug c/113727] " sjames at gcc dot gnu.org
2024-02-02 20:40 ` dcb314 at hotmail dot com
2024-02-02 21:03 ` dcb314 at hotmail dot com
2024-02-02 21:15 ` dcb314 at hotmail dot com
2024-02-02 21:40 ` dcb314 at hotmail dot com
2024-02-02 21:47 ` dcb314 at hotmail dot com
2024-02-02 21:49 ` sjames at gcc dot gnu.org
2024-02-03 10:11 ` xry111 at gcc dot gnu.org
2024-02-03 10:15 ` xry111 at gcc dot gnu.org
2024-02-03 11:07 ` dcb314 at hotmail dot com
2024-02-03 11:08 ` dcb314 at hotmail dot com
2024-02-03 18:54 ` xry111 at gcc dot gnu.org
2024-02-04 19:42 ` [Bug c/113727] [14 Regression] " pinskia at gcc dot gnu.org
2024-03-15 15:01 ` [Bug tree-optimization/113727] " law at gcc dot gnu.org
2024-03-18  8:45 ` sjames at gcc dot gnu.org
2024-03-19  5:58 ` sjames at gcc dot gnu.org
2024-03-19  6:04 ` sjames at gcc dot gnu.org
2024-03-19  6:09 ` pinskia at gcc dot gnu.org
2024-03-19  6:24 ` pinskia at gcc dot gnu.org
2024-03-19  6:41 ` pinskia at gcc dot gnu.org
2024-03-19  6:47 ` pinskia at gcc dot gnu.org
2024-03-19  9:46 ` [Bug tree-optimization/113727] [14 Regression] csmith: differences from nothing to -O1 since r14-4612-g6decda1a35be57 rguenth at gcc dot gnu.org
2024-03-19 10:51 ` rguenth at gcc dot gnu.org
2024-03-19 11:22 ` rguenth at gcc dot gnu.org [this message]
2024-03-19 13:40 ` rguenth at gcc dot gnu.org
2024-03-21  7:33 ` cvs-commit at gcc dot gnu.org
2024-03-21  7:34 ` rguenth 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-113727-4-CHyrUsqYuM@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).