public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: gcc-patches@gcc.gnu.org, hubicka@ucw.cz
Subject: Re: [PATCH] [PR111520] set hardcmp eh probs (was: rename make_eh_edges to make_eh_edge)
Date: Mon, 23 Oct 2023 09:59:37 +0200	[thread overview]
Message-ID: <CAFiYyc3gKr16ErjYu9J4nd6Lun4V9v5m-k5XfQ1GRJC-2W=kAw@mail.gmail.com> (raw)
In-Reply-To: <or1qdoculr.fsf_-_@lxoliva.fsfla.org>

On Sat, Oct 21, 2023 at 9:17 AM Alexandre Oliva <oliva@adacore.com> wrote:
>
> On Oct 20, 2023, Richard Biener <richard.guenther@gmail.com> wrote:
>
> >> * tree-eh.h (make_eh_edges): Rename to...
> >> (make_eh_edge): ... this.
> >> * tree-eh.cc: Likewise.  Adjust all callers.
>
> Once the above goes in (it depends on the strub monster patch), the
> following one should apply as well.  Regstrapped on x86_64-linux-gnu.
> Ok to install?

OK.

> Set execution count of EH blocks, and probability of EH edges.
>
>
> for  gcc/ChangeLog
>
>         PR tree-optimization/111520
>         * gimple-harden-conditionals.cc
>         (pass_harden_compares::execute): Set EH edge probability and
>         EH block execution count.
>
> for  gcc/testsuite/ChangeLog
>
>         PR tree-optimization/111520
>         * g++.dg/torture/harden-comp-pr111520.cc: New.
> ---
>  gcc/gimple-harden-conditionals.cc                  |   12 +++++++++++-
>  .../g++.dg/torture/harden-comp-pr111520.cc         |   17 +++++++++++++++++
>  2 files changed, 28 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc
>
> diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc
> index 1999e827a04ca..bded288985063 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)
> diff --git a/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc
> new file mode 100644
> index 0000000000000..b4381b4d84ec4
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/torture/harden-comp-pr111520.cc
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */
> +/* { dg-options "-fharden-compares -fsignaling-nans -fnon-call-exceptions" } */
> +
> +struct S
> +{
> +  S (bool);
> +  ~S ();
> +};
> +
> +float f;
> +
> +void
> +foo ()
> +{
> +  S a = 0;
> +  S b = f;
> +}
>
>
> --
> Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
>    Free Software Activist                   GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive

  reply	other threads:[~2023-10-23  8:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  7:58 [PATCH] return edge in make_eh_edges Alexandre Oliva
2023-10-19  9:09 ` Richard Biener
2023-10-20  3:34   ` Alexandre Oliva
2023-10-20  6:09   ` [PATCH] rename make_eh_edges to make_eh_edge (was: return edge in make_eh_edges) Alexandre Oliva
2023-10-20  6:34     ` Richard Biener
2023-10-21  7:17       ` [PATCH] [PR111520] set hardcmp eh probs (was: rename make_eh_edges to make_eh_edge) Alexandre Oliva
2023-10-23  7:59         ` Richard Biener [this message]
2023-10-26  6:23       ` [PATCH] rename make_eh_edges to make_eh_edge 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='CAFiYyc3gKr16ErjYu9J4nd6Lun4V9v5m-k5XfQ1GRJC-2W=kAw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=oliva@adacore.com \
    /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).