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/100382] [12 Regression] go.test/test/fixedbugs/issue16095.go hang since r12-248
Date: Mon, 03 May 2021 07:13:14 +0000	[thread overview]
Message-ID: <bug-100382-4-WbREYJThfN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100382-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
With the following patch this "issue" would show.  Not sure why we think
a postdom walk is appropriate for DSE rather than a reverse program order one.

diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index aecf6ab8c46..5bb5adf43c6 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "builtins.h"
 #include "gimple-fold.h"
 #include "gimplify.h"
+#include "cfganal.h"

 /* This file implements dead store elimination.

@@ -1280,7 +1281,16 @@ pass_dse::execute (function *fun)
   /* Dead store elimination is fundamentally a walk of the post-dominator
      tree and a backwards walk of statements within each block.  */
   dse_dom_walker walker (CDI_POST_DOMINATORS);
-  walker.walk (fun->cfg->x_exit_block_ptr);
+  //walker.walk (fun->cfg->x_exit_block_ptr);
+  int *rpo = XNEWVEC (int, n_basic_blocks_for_fn (fun) - NUM_FIXED_BLOCKS);
+  auto_bitmap exits;
+  edge entry = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (fun));
+  bitmap_set_bit (exits, EXIT_BLOCK);
+  int n = rev_post_order_and_mark_dfs_back_seme
+    (fun, entry, exits, true, rpo, NULL);
+  for (int i = n; i != 0; --i)
+    walker.before_dom_children (BASIC_BLOCK_FOR_FN (fun, rpo[i-1]));
+  free (rpo);
   free_dominance_info (CDI_POST_DOMINATORS);

   unsigned todo = walker.todo ();

  parent reply	other threads:[~2021-05-03  7:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-02 14:54 [Bug tree-optimization/100382] New: " jakub at gcc dot gnu.org
2021-05-02 14:54 ` [Bug tree-optimization/100382] " jakub at gcc dot gnu.org
2021-05-02 17:46 ` jakub at gcc dot gnu.org
2021-05-03  6:51 ` rguenth at gcc dot gnu.org
2021-05-03  7:13 ` rguenth at gcc dot gnu.org [this message]
2021-05-03 10:04 ` cvs-commit at gcc dot gnu.org
2021-05-03 10:12 ` jakub at gcc dot gnu.org
2021-10-25 12:09 ` cvs-commit 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-100382-4-WbREYJThfN@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).