From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 1FB843858425; Sat, 21 Oct 2023 03:36:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FB843858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697859375; bh=IyIqQRawYy6jm0tF70VMHON8elzSlJUMGC0xITj8o1w=; h=From:To:Subject:Date:From; b=l5uRftov2xq+CbtHxXZXaZ+YXk+58t5FFOOIVV5NKNWhCfBKlsTTw/ceyszKvOjjk WlGT0ztS0PIwYGoQfagQ8Cf14oY3QA5uvNROexX2GSTKYEz8yUPBrB3VbMfmfcQ/4N 8EYPybDPFDPAjiJ3fQB9F7srFETIKOicS+0JCpLo= 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)] set hardcmp eh probs X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: abbba098e8d5137249c492ddd5cb1ac7186a4464 X-Git-Newrev: 372f260408cf0149fbd3dd34872cde0a8b48610d Message-Id: <20231021033615.1FB843858425@sourceware.org> Date: Sat, 21 Oct 2023 03:36:15 +0000 (GMT) List-Id: https://gcc.gnu.org/g:372f260408cf0149fbd3dd34872cde0a8b48610d commit 372f260408cf0149fbd3dd34872cde0a8b48610d Author: Alexandre Oliva Date: Sat Oct 21 00:30:33 2023 -0300 set hardcmp eh probs Diff: --- gcc/gimple-harden-conditionals.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc index 1999e827a04c..bded28898506 100644 --- a/gcc/gimple-harden-conditionals.cc +++ b/gcc/gimple-harden-conditionals.cc @@ -580,11 +580,21 @@ pass_harden_compares::execute (function *fun) if (throwing_compare_p) { add_stmt_to_eh_lp (asgnck, lookup_stmt_eh_lp (asgn)); - make_eh_edge (asgnck); + edge eh = make_eh_edge (asgnck); + /* This compare looks like it could raise an exception, + but it's dominated by the original compare, that + would raise an exception first, so the EH edge from + this one is never really taken. */ + eh->probability = profile_probability::never (); + if (eh->dest->count.initialized_p ()) + eh->dest->count += eh->count (); + else + eh->dest->count = eh->count (); edge ckeh; basic_block nbb = split_edge (non_eh_succ_edge (gimple_bb (asgnck), &ckeh)); + gcc_checking_assert (eh == ckeh); gsi_split = gsi_start_bb (nbb); if (dump_file)