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 middle-end/107047] load introduced of struct fields after assigning it to a local variable
Date: Tue, 27 Sep 2022 09:10:03 +0000	[thread overview]
Message-ID: <bug-107047-4-0fwe9MZujt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107047-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-09-27
           Keywords|                            |missed-optimization
      Known to fail|                            |12.2.1, 13.0
     Ever confirmed|0                           |1
          Component|rtl-optimization            |middle-end

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, we see

  <bb 2> [local count: 1073741824]:
  f[1][6] = g_36;
  _1 = BIT_FIELD_REF <f[1][6], 32, 0>;
  _8 = _1 & 16777215;
  if (_8 != 0)

VN probably sees the def but it doesn't consider replacing the use with
a BIT_FIELD_REF of g_36, it just translates the ref but doesn't find
any definition to CSE from.

SRA says

Candidate (1991): f
Too big to totally scalarize: f (UID: 1991)
Created a replacement for f offset: 848, size: 8: f$1$6$f1D.1996

Access trees for f (UID: 1991):
access { base = (1991)'f', offset = 832, size = 64, expr = f[1][6], type =
struct S6, reverse = 0, grp_read = 1, grp_write = 1, grp_assignment_read = 1,
grp_assignment_write = 1, grp_scalar_read = 0, grp_scalar_write = 0,
grp_total_scalarization = 0, grp_hint = 0, grp_covered = 0,
grp_unscalarizable_region = 0, grp_unscalarized_data = 1, grp_same_access_path
= 1, grp_partial_lhs = 0, grp_to_be_replaced = 0, grp_to_be_debug_replaced = 0}
* access { base = (1991)'f', offset = 848, size = 8, expr = f[1][6].f1, type =
char, reverse = 0, grp_read = 1, grp_write = 1, grp_assignment_read = 1,
grp_assignment_write = 1, grp_scalar_read = 1, grp_scalar_write = 0,
grp_total_scalarization = 0, grp_hint = 0, grp_covered = 1,
grp_unscalarizable_region = 0, grp_unscalarized_data = 0, grp_same_access_path
= 1, grp_partial_lhs = 0, grp_to_be_replaced = 1, grp_to_be_debug_replaced = 0}

but somehow it does not create an access for

  _1 = BIT_FIELD_REF <f[1][6], 32, 0>;
  _2 = (unsigned int) _1;

note the real offender here is (again) optimize_bit_field_compare ...

  reply	other threads:[~2022-09-27  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  7:25 [Bug rtl-optimization/107047] New: " absoler at smail dot nju.edu.cn
2022-09-27  9:10 ` rguenth at gcc dot gnu.org [this message]
2022-10-05 20:02 ` [Bug middle-end/107047] " pinskia at gcc dot gnu.org
2022-10-26  8:31 ` [Bug middle-end/107047] load introduced of struct/union " absoler at smail dot nju.edu.cn

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-107047-4-0fwe9MZujt@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).