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/115034] Missed optimization: reduntant store of identical value in the slot
Date: Mon, 13 May 2024 09:33:48 +0000	[thread overview]
Message-ID: <bug-115034-4-6f5GaO0Tzp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115034-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2024-05-13
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
This would work if we'd duplicate the path from a = 0 to *outl = 1; return 0;
but we don't early enough (on GIMPLE) and we don't do that on RTL until
BB reorder where ther's no later pass doing this optimization either.

On GIMPLE we see

  <bb 2> [local count: 1073741824]:
  *outl_4(D) = 0;
  if (c1_6(D) != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 5>; [50.00%]
...
  <bb 5> [local count: 965079152]:
  # a_1 = PHI <1(3), 0(2)>
  *outl_4(D) = a_1;
  return 0;

but I think tracer doesn't consider paths to exit aka tail duplication,
likely because on GIMPLE we force a single return block.  There's also
no partial redundant store elimination.

      parent reply	other threads:[~2024-05-13  9:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 14:34 [Bug tree-optimization/115034] New: " xxs_chy at outlook dot com
2024-05-10 14:43 ` [Bug tree-optimization/115034] " pinskia at gcc dot gnu.org
2024-05-10 15:32 ` xxs_chy at outlook dot com
2024-05-13  9:33 ` rguenth at gcc dot gnu.org [this message]

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-115034-4-6f5GaO0Tzp@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).