public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] hardcfr: add checking at exceptions and noreturn calls: tweaks
Date: Thu, 11 Aug 2022 01:57:50 +0000 (GMT)	[thread overview]
Message-ID: <20220811015750.288E73857BA1@sourceware.org> (raw)

https://gcc.gnu.org/g:125b843bb77c74a9329fa1b1db4dfcc688b5a054

commit 125b843bb77c74a9329fa1b1db4dfcc688b5a054
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Wed Aug 10 22:56:28 2022 -0300

    hardcfr: add checking at exceptions and noreturn calls: tweaks

Diff:
---
 gcc/gimple-harden-control-flow.cc | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc
index 5066a43fe6c..6d56e78dd8d 100644
--- a/gcc/gimple-harden-control-flow.cc
+++ b/gcc/gimple-harden-control-flow.cc
@@ -772,10 +772,6 @@ pass_harden_control_flow_redundancy::execute (function *fun)
 	      if (!bb_eh_cleanup)
 		{
 		  bb_eh_cleanup = create_empty_bb (bb);
-		  if (dom_info_available_p (CDI_DOMINATORS))
-		    set_immediate_dominator (CDI_DOMINATORS, bb_eh_cleanup, bb);
-		  if (current_loops)
-		    add_bb_to_loop (bb_eh_cleanup, current_loops->tree_root);
 
 		  /* Make the new block an EH cleanup for the call.  */
 		  eh_region new_r = gen_eh_region_cleanup (NULL);
@@ -791,15 +787,18 @@ pass_harden_control_flow_redundancy::execute (function *fun)
 		  gresx *resx = gimple_build_resx (new_r->index);
 		  gsi_insert_before (&ehgsi, resx, GSI_SAME_STMT);
 		}
-	      else
-		{
-		  // Update immedite dominator and loop?
-		}
 
 	      add_stmt_to_eh_lp (stmt, lp_eh_cleanup);
 	      /* Finally, wire the EH cleanup block into the CFG.  */
 	      make_eh_edges (stmt);		}
 	}
+
+      if (bb_eh_cleanup && dom_info_available_p (CDI_DOMINATORS))
+	{
+	  basic_block immdom;
+	  immdom = recompute_dominator (CDI_DOMINATORS, bb_eh_cleanup);
+	  set_immediate_dominator (CDI_DOMINATORS, bb_eh_cleanup, immdom);
+	}
     }
 
   /* We wish to add verification at blocks without successors, such as


             reply	other threads:[~2022-08-11  1:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  1:57 Alexandre Oliva [this message]
2022-08-11  2:20 Alexandre Oliva
2022-08-11  2:24 Alexandre Oliva
2022-08-11  2:34 Alexandre Oliva
2022-08-11  2:50 Alexandre Oliva
2022-08-11  4:13 Alexandre Oliva
2022-08-11  4:24 Alexandre Oliva
2022-08-11  5:08 Alexandre Oliva
2022-08-11  5:17 Alexandre Oliva
2022-08-11  5:20 Alexandre Oliva
2022-08-11  5:22 Alexandre Oliva
2022-08-11  5:45 Alexandre Oliva
2022-08-11  6:43 Alexandre Oliva
2022-08-11  6:54 Alexandre Oliva
2022-08-11  7:07 Alexandre Oliva
2022-08-11  7:13 Alexandre Oliva
2022-08-11  7:28 Alexandre Oliva
2022-08-24 16:53 Alexandre Oliva
2022-08-24 17:18 Alexandre Oliva
2022-08-24 19:39 Alexandre Oliva
2022-08-24 22:46 Alexandre Oliva
2022-08-24 22:59 Alexandre Oliva

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=20220811015750.288E73857BA1@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@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).