From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 7537F385F026; Wed, 24 Aug 2022 16:52:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7537F385F026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661359973; bh=qDaNPpVSBclQnObbTZ/bYPhqM8AlCKumP3P+Q0Sw4R8=; h=From:To:Subject:Date:From; b=JDYsaT5Vx90OCJ5w5kgP879cAmdrxxAGkHtH1XFZHbczJL4rbFDTQ+qpiZAtNtDNj tiQ6YbzFZjVFu3l36sq3HNvid36B1OcefQ7HaySX4OthWk+9DRqM4lxGp2iKQpfQZw PodK0f9h4ZALyv2LYQeKMw0Cohp+ZAnbLMc4MQio= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] enable control flow redundancy hardening unconditionally X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: fecdbdf9c6c935b79a61d540c280ea1885f3c867 X-Git-Newrev: 02a199b6b017a22a72e49f0d7ffef9edb7f90e42 Message-Id: <20220824165253.7537F385F026@sourceware.org> Date: Wed, 24 Aug 2022 16:52:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:02a199b6b017a22a72e49f0d7ffef9edb7f90e42 commit 02a199b6b017a22a72e49f0d7ffef9edb7f90e42 Author: Alexandre Oliva Date: Wed Aug 24 13:36:58 2022 -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 e347251f713..e0a002e6b16 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1798,7 +1798,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. ; Nonzero means ignore `#ident' directives. 0 means handle them. diff --git a/gcc/gimple-harden-control-flow.cc b/gcc/gimple-harden-control-flow.cc index 6b08846dbb1..8932d548a20 100644 --- a/gcc/gimple-harden-control-flow.cc +++ b/gcc/gimple-harden-control-flow.cc @@ -97,6 +97,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 % or similar," " %<-fharden-control-flow-redundancy%> is not supported", @@ -110,6 +112,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", @@ -120,6 +124,8 @@ public: if (param_hardcfr_max_blocks > 0 && n_basic_blocks_for_fn (fun) - 2 > 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 ae214daa207..09852d65898 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=