public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/111293] [14 Regression] Missed Dead Code Elimination since r14-3414-g0cfc9c953d0
Date: Tue, 09 Apr 2024 09:47:14 +0000	[thread overview]
Message-ID: <bug-111293-4-oRbfPMlCu9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111293-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> ---
For what's worth adding -fno-tree-vrp "fixes" this and enables removal of the
call to 'foo' with trunk.

Here is a minimal revert of the regressing revision, but it may just make the
problem latent.

diff --git a/gcc/gimple-range-phi.cc b/gcc/gimple-range-phi.cc
index 01900a35b32..9fa9fe83ce0 100644
--- a/gcc/gimple-range-phi.cc
+++ b/gcc/gimple-range-phi.cc
@@ -386,14 +386,6 @@ phi_analyzer::process_phi (gphi *phi)
                  m_work.safe_push (arg);
                  continue;
                }
-             // More than 2 outside names is too complicated.
-             if (m_num_extern >= 2)
-               {
-                 cycle_p = false;
-                 break;
-               }
-             m_external[m_num_extern] = arg;
-             m_ext_edge[m_num_extern++] = gimple_phi_arg_edge (phi_stmt, x);
            }
          else if (code == INTEGER_CST)
            {
@@ -402,12 +394,15 @@ phi_analyzer::process_phi (gphi *phi)
                                wi::to_wide (arg));
              init_range.union_ (val);
            }
-         else
+         // More than 2 outside names/CONST is too complicated.
+         if (m_num_extern >= 2)
            {
-             // Everything else terminates the cycle.
              cycle_p = false;
              break;
            }
+
+         m_external[m_num_extern] = arg;
+         m_ext_edge[m_num_extern++] = gimple_phi_arg_edge (phi_stmt, x);
        }
     }

  parent reply	other threads:[~2024-04-09  9:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 15:01 [Bug tree-optimization/111293] New: " theodort at inf dot ethz.ch
2023-09-05 17:25 ` [Bug tree-optimization/111293] " pinskia at gcc dot gnu.org
2023-09-05 17:40 ` pinskia at gcc dot gnu.org
2023-09-05 17:40 ` pinskia at gcc dot gnu.org
2023-11-24 15:56 ` amacleod at redhat dot com
2024-03-07 23:21 ` law at gcc dot gnu.org
2024-04-09  9:38 ` mikael at gcc dot gnu.org
2024-04-09  9:47 ` mikael at gcc dot gnu.org [this message]
2024-05-07  7:41 ` [Bug tree-optimization/111293] [14/15 " rguenth 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-111293-4-oRbfPMlCu9@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).