public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-3757] _BitInt profile fixes [PR102989]
@ 2023-09-06 15:58 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2023-09-06 15:58 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3ad9948b3e716885ce66bdf1c8e053880a843a2b
commit r14-3757-g3ad9948b3e716885ce66bdf1c8e053880a843a2b
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Sep 6 17:49:44 2023 +0200
_BitInt profile fixes [PR102989]
On Thu, Aug 24, 2023 at 03:14:32PM +0200, Jan Hubicka via Gcc-patches wrote:
> this patch extends verifier to check that all probabilities and counts are
> initialized if profile is supposed to be present. This is a bit complicated
> by the posibility that we inline !flag_guess_branch_probability function
> into function with profile defined and in this case we need to stop
> verification. For this reason I added flag to cfg structure tracking this.
This patch broke a couple of _BitInt tests (in the admittedly still
uncommitted series - still waiting for review of the C FE bits).
Here is a minimal patch to make it work again, though I'm not sure
if in the if_then_else and if_then_if_then_else cases I shouldn't scale
count of the other bbs as well. if_then method creates
if (COND) new_bb1;
in a middle of some pre-existing bb (with PROB that COND is true), if_then_else
if (COND) new_bb1; else new_bb2;
and if_then_if_then_else
if (COND1) { if (COND2) new_bb2; else new_bb1; }
with PROB1 and PROB2 probabilities that COND1 and COND2 are true.
The lowering happens shortly after IPA.
2023-09-06 Jakub Jelinek <jakub@redhat.com>
PR c/102989
* gimple-lower-bitint.cc (bitint_large_huge::if_then_else,
bitint_large_huge::if_then_if_then_else): Use make_single_succ_edge
rather than make_edge, initialize bb->count.
Diff:
---
gcc/gimple-lower-bitint.cc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index 3906c00bf3fa..dceaec779c82 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -683,9 +683,10 @@ bitint_large_huge::if_then_else (gimple *cond, profile_probability prob,
e1->flags = EDGE_FALSE_VALUE;
e3->probability = prob;
e1->probability = prob.invert ();
+ bb->count = e1->src->count.apply_probability (prob);
set_immediate_dominator (CDI_DOMINATORS, bb, e1->src);
set_immediate_dominator (CDI_DOMINATORS, e2->dest, e1->src);
- edge_true = make_edge (bb, e2->dest, EDGE_FALLTHRU);
+ edge_true = make_single_succ_edge (bb, e2->dest, EDGE_FALLTHRU);
edge_false = e2;
m_gsi = gsi_after_labels (bb);
}
@@ -741,7 +742,8 @@ bitint_large_huge::if_then_if_then_else (gimple *cond1, gimple *cond2,
e4->probability = prob2;
e2->flags = EDGE_FALSE_VALUE;
e2->probability = prob2.invert ();
- e4 = make_edge (bb, e3->dest, EDGE_FALLTHRU);
+ bb->count = e2->src->count.apply_probability (prob2);
+ e4 = make_single_succ_edge (bb, e3->dest, EDGE_FALLTHRU);
e2 = find_edge (e2->dest, e3->dest);
edge_true_true = e4;
edge_true_false = e2;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-06 15:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06 15:58 [gcc r14-3757] _BitInt profile fixes [PR102989] Jakub Jelinek
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).