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)] [PR105455] Set edge probabilities when hardening conditionals Date: Wed, 11 May 2022 07:32:30 +0000 (GMT) [thread overview] Message-ID: <20220511073230.06D2A384B12D@sourceware.org> (raw) https://gcc.gnu.org/g:9165f59c421366497a6d96f00ca657fd370e146d commit 9165f59c421366497a6d96f00ca657fd370e146d Author: Alexandre Oliva <oliva@adacore.com> Date: Wed May 11 04:27:42 2022 -0300 [PR105455] Set edge probabilities when hardening conditionals Diff: --- gcc/gimple-harden-conditionals.cc | 2 ++ gcc/testsuite/gcc.dg/pr105455.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/gcc/gimple-harden-conditionals.cc b/gcc/gimple-harden-conditionals.cc index 28c4810f0a7..240d0e5acd8 100644 --- a/gcc/gimple-harden-conditionals.cc +++ b/gcc/gimple-harden-conditionals.cc @@ -254,8 +254,10 @@ insert_check_and_trap (location_t loc, gimple_stmt_iterator *gsip, equality. */ single_succ_edge (chk)->flags &= ~EDGE_FALLTHRU; single_succ_edge (chk)->flags |= neg_true_false_flag; + single_succ_edge (chk)->probability = profile_probability::always (); edge e = make_edge (chk, trp, true_false_flag); e->goto_locus = loc; + e->probability = profile_probability::never (); if (dom_info_available_p (CDI_DOMINATORS)) set_immediate_dominator (CDI_DOMINATORS, trp, chk); diff --git a/gcc/testsuite/gcc.dg/pr105455.c b/gcc/testsuite/gcc.dg/pr105455.c new file mode 100644 index 00000000000..81e9154baa1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105455.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fharden-conditional-branches -funroll-loops --param max-loop-header-insns=1" } */ + +__attribute__ ((cold)) void +bar (void); + +void +foo (int x) +{ + if (x) + { + int i; + + for (i = 0; i < 101; ++i) + bar (); + } +}
next reply other threads:[~2022-05-11 7:32 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-11 7:32 Alexandre Oliva [this message] 2022-05-11 9:36 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=20220511073230.06D2A384B12D@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: linkBe 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).