public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104530] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0)
Date: Tue, 15 Feb 2022 23:14:44 +0000	[thread overview]
Message-ID: <bug-104530-4-s5yWZy9e6s@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104530-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Andrew Macleod <amacleod at redhat dot com> ---
mmm. tricky.  

Imports: b.0_1  d.3_7
Exports: b.0_1  _2  _3  d.3_7  _8
         _2 : b.0_1(I)
         _3 : b.0_1(I)  _2
         _8 : b.0_1(I)  _2  _3  d.3_7(I)

    <bb 2> :
    b.0_1 = b;
    _2 = b.0_1 == 0B;
    _3 = (int) _2;
    c = _3;
    _5 = *b.0_1;        <<-- from this point b.0_1 is [+1, +INF]
    a = _5;
    d.3_7 = d;
    _8 = _3 % d.3_7;
    if (_8 != 0)
      goto <bb 6>; [INV]
    else
      goto <bb 5>; [INV]

This is a bit at conflict with the "lets be safe" approach without pre-scanning
the block for lack of throwing stmts.   Although that's really just a half
measure since you can construct more complicated blocks with a mix.

Im experimenting with marking values as stale for all exports of the block
which are dependant on the value we set to non null. ie, _2, _3 and _8 

Then when we ask for a range of that name AFTER the de-reference, it will
recompute it.  The use of _3 in computing _8 is then "stale", and will be
re-evaluated.

Simple in concept, but I'm encountering an interaction with how we currently
set the global values for the end of the pass, and although I can recompute _2
fine, it is also setting the global value of _2 to [0,0], which is not what we
want.  Works for this case, but returns us to the same situation we had before
if there is a call in the block.

Im continuing to look at it.  Easy fix in the next release since we are going
to change the way we export globals outside the pass... but we shall see about
this release whether I can keep it contained.

  parent reply	other threads:[~2022-02-15 23:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 16:40 [Bug tree-optimization/104530] New: " theodort at inf dot ethz.ch
2022-02-14 16:47 ` [Bug tree-optimization/104530] " jakub at gcc dot gnu.org
2022-02-15 23:14 ` amacleod at redhat dot com [this message]
2022-02-21 13:10 ` jakub at gcc dot gnu.org
2022-04-19 15:36 ` rguenth at gcc dot gnu.org
2022-05-06  8:32 ` [Bug tree-optimization/104530] [12/13 " jakub at gcc dot gnu.org
2022-11-08  0:22 ` cvs-commit at gcc dot gnu.org
2022-11-08  0:23 ` amacleod at redhat dot com

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-104530-4-s5yWZy9e6s@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).