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 debug/105161] variable constant-folded in its uses appears as optimized out depending on where it is assigned
Date: Wed, 06 Apr 2022 06:33:42 +0000	[thread overview]
Message-ID: <bug-105161-4-IypKQz6lA6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105161-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-04-06
                 CC|                            |aoliva at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is the same issue as PR105158 but this time there is really no place to
put the debug stmt since the predecessor has two successors and the successor
has two predecessors.  Since we want to generate the same code for -g and -g0
the only option would be to never remove a forwarder block in such case, but
that would
cause an artificial unconditional jump in the assembly (that would then be
the place the variable becomes live).

Alternatively we could do liveness analysis for the special case of the
successor having a backedge predecessor and see whether the variable
can get a different value from that edge or not (in this case it can not).

Maybe var-tracking dataflow would in the end compute this but then we'd have
to arrange for the debug stmts to live on CFG edges (to avoid the empty
forwarder block).

We could also retain the forwarder and make sure it ends up fall-thru, then
_maybe_ that's enough to not cause worse code generation.

Alex - any thoughts on the code-gen/var-tracking issue?  I suppose we really
don't want to go down adding debug stmts to edges, but retaining the forwarder
(at least with -Og?) would also avoid re-creating/re-removing it with each
critical edge splitting.

  reply	other threads:[~2022-04-06  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 14:25 [Bug debug/105161] New: " assaiante at diag dot uniroma1.it
2022-04-06  6:33 ` rguenth at gcc dot gnu.org [this message]
2022-04-08 17:26 ` [Bug debug/105161] " aoliva 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-105161-4-IypKQz6lA6@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).