public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/102546] Missed Dead Code Elimination regression (trunk vs 11.2.0) at -O3
Date: Thu, 30 Sep 2021 17:21:52 +0000	[thread overview]
Message-ID: <bug-102546-4-Blj2qEJJLI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102546-4@http.gcc.gnu.org/bugzilla/>

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |amacleod at redhat dot com

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
By VRP1 we seem to be calculating the following:

(f_8 << f_8) && (f_8 == 0)

This would fold to false, which would elide the foo():

 <bb 7> [local count: 59055800]:
  b = 0;
  _3 = f_8 << f_8;
  _4 = (char) _3;
  _5 = (int) _4;
  if (_4 > 0)
    goto <bb 8>; [64.06%]
  else
    goto <bb 10>; [35.94%]

  <bb 8> [local count: 34842922]:
  if (f_8 == 0)
    goto <bb 9>; [71.10%]
  else
    goto <bb 10>; [28.90%]

  <bb 9> [local count: 12809203]:
  foo ();

So from the outset, it seems like this is a missing relation in range-ops. 
That is if we know f_8 << f_8 is non-zero, then we know f_8 cannot be 0.  This
looks like an easy fix, however...

What I fail to see is how "a" got removed entirely from the IL, making this
scenario possible:

 if (!(a >= d || f))
            foo();

Am I missing something obvious here?

  parent reply	other threads:[~2021-09-30 17:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 13:22 [Bug tree-optimization/102546] New: " theodort at inf dot ethz.ch
2021-09-30 13:22 ` [Bug tree-optimization/102546] " theodort at inf dot ethz.ch
2021-09-30 17:21 ` aldyh at gcc dot gnu.org [this message]
2021-09-30 17:44 ` aldyh at gcc dot gnu.org
2021-09-30 22:50 ` [Bug tree-optimization/102546] [12 Regregression] " pinskia at gcc dot gnu.org
2021-10-01  6:30 ` rguenth at gcc dot gnu.org
2021-10-01  9:18 ` aldyh at gcc dot gnu.org
2021-10-01  9:19 ` aldyh at gcc dot gnu.org
2021-10-01  9:36 ` zhendong.su at inf dot ethz.ch
2021-10-01 13:02 ` amacleod at redhat dot com
2021-10-01 22:04 ` cvs-commit at gcc dot gnu.org
2021-10-01 22:05 ` aldyh at gcc dot gnu.org
2021-10-01 22:20 ` jakub at gcc dot gnu.org
2021-10-01 22:24 ` aldyh at redhat dot com
2021-10-01 22:38 ` 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-102546-4-Blj2qEJJLI@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).