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)] enable control flow redundancy hardening unconditionally
Date: Fri,  9 Jun 2023 06:17:28 +0000 (GMT)	[thread overview]
Message-ID: <20230609061728.2D71B385703C@sourceware.org> (raw)

https://gcc.gnu.org/g:53ddfc84f35372e488988ee8231af2ddf54e2eeb

commit 53ddfc84f35372e488988ee8231af2ddf54e2eeb
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Jun 8 01:35:37 2023 -0300

    enable control flow redundancy hardening unconditionally

Diff:
---
 gcc/common.opt                    | 2 +-
 gcc/gimple-harden-control-flow.cc | 6 ++++++
 gcc/params.opt                    | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index cee34a74245..99c4a9085b1 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1802,7 +1802,7 @@ Common Var(flag_harden_conditional_branches) Optimization
 Harden conditional branches by checking reversed conditions.
 
 fharden-control-flow-redundancy
-Common Var(flag_harden_control_flow_redundancy) Optimization
+Common Var(flag_harden_control_flow_redundancy) Init(-1) Optimization
 Harden control flow by recording and checking execution paths.
 
 fhardcfr-skip-leaf
diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc
index 044671cab79..faafaf7c8a0 100644
--- a/gcc/gimple-harden-control-flow.cc
+++ b/gcc/gimple-harden-control-flow.cc
@@ -91,6 +91,8 @@ public:
        call and restore it if it returns again.  */
     if (fun->calls_setjmp)
       {
+	if (flag_harden_control_flow_redundancy < 0)
+	  return false;
 	warning_at (DECL_SOURCE_LOCATION (fun->decl), 0,
 		    "%qD calls %<setjmp%> or similar,"
 		    " %<-fharden-control-flow-redundancy%> is not supported",
@@ -104,6 +106,8 @@ public:
        enough to make it worthwhile.  */
     if (fun->has_nonlocal_label)
       {
+	if (flag_harden_control_flow_redundancy < 0)
+	  return false;
 	warning_at (DECL_SOURCE_LOCATION (fun->decl), 0,
 		    "%qD receives nonlocal gotos,"
 		    " %<-fharden-control-flow-redundancy%> is not supported",
@@ -115,6 +119,8 @@ public:
 	&& (n_basic_blocks_for_fn (fun) - NUM_FIXED_BLOCKS
 	    > param_hardcfr_max_blocks))
       {
+	if (flag_harden_control_flow_redundancy < 0)
+	  return false;
 	warning_at (DECL_SOURCE_LOCATION (fun->decl), 0,
 		    "%qD has more than %u blocks, the requested"
 		    " maximum for %<-fharden-control-flow-redundancy%>",
diff --git a/gcc/params.opt b/gcc/params.opt
index 799ea41cedf..a2b6cefa0cc 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -183,7 +183,7 @@ Common Joined UInteger Var(param_graphite_max_nb_scop_params) Init(10) Param Opt
 Maximum number of parameters in a SCoP.
 
 -param=hardcfr-max-blocks=
-Common Joined UInteger Var(param_hardcfr_max_blocks) Init(0) Param Optimization
+Common Joined UInteger Var(param_hardcfr_max_blocks) Init(32) Param Optimization
 Maximum number of blocks for -fharden-control-flow-redundancy.
 
 -param=hardcfr-max-inline-blocks=

             reply	other threads:[~2023-06-09  6:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  6:17 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-10-10  4:14 Alexandre Oliva
2023-10-06  5:25 Alexandre Oliva
2023-06-29 18:42 Alexandre Oliva
2023-06-29 13:48 Alexandre Oliva
2023-06-09 11:32 Alexandre Oliva
2023-06-08 10:59 Alexandre Oliva
2023-06-08 10:43 Alexandre Oliva
2023-06-08  9:17 Alexandre Oliva
2023-06-08  4:48 Alexandre Oliva
2022-08-24 16:52 Alexandre Oliva
2022-08-10 23:51 Alexandre Oliva
2022-07-07 15:15 Alexandre Oliva
2022-05-06  7:19 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=20230609061728.2D71B385703C@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).