public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/switch-lowering-fix-profile)] Fix first part of problems.
@ 2022-01-25 16:00 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-01-25 16:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:192ac7a1ff2d248e508055a048b7972a485edda2

commit 192ac7a1ff2d248e508055a048b7972a485edda2
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jan 24 15:45:38 2022 +0100

    Fix first part of problems.

Diff:
---
 gcc/tree-switch-conversion.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index 670397c87e4..7607f5ae019 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -2162,6 +2162,7 @@ switch_decision_tree::emit_cmp_and_jump_insns (basic_block bb, tree op0,
   edge false_edge = split_block (bb, cond);
   false_edge->flags = EDGE_FALSE_VALUE;
   false_edge->probability = prob.invert ();
+  false_edge->dest->count = bb->count.apply_probability (prob.invert ());
 
   edge true_edge = make_edge (bb, label_bb, EDGE_TRUE_VALUE);
   true_edge->probability = prob;
@@ -2192,6 +2193,7 @@ switch_decision_tree::do_jump_if_equal (basic_block bb, tree op0, tree op1,
   edge false_edge = split_block (bb, cond);
   false_edge->flags = EDGE_FALSE_VALUE;
   false_edge->probability = prob.invert ();
+  false_edge->dest->count = bb->count.apply_probability (prob.invert ());
 
   edge true_edge = make_edge (bb, label_bb, EDGE_TRUE_VALUE);
   true_edge->probability = prob;
@@ -2262,6 +2264,7 @@ switch_decision_tree::emit_case_nodes (basic_block bb, tree index,
 	      p = ((node->m_right->m_c->m_subtree_prob
 		    + default_prob.apply_scale (1, 2))
 		   / (node->m_c->m_subtree_prob + default_prob));
+	      test_bb->count = bb->count.apply_probability (p);
 	      bb = emit_cmp_and_jump_insns (bb, index, node->m_c->get_high (),
 					    GT_EXPR, test_bb, p, loc);
 	      default_prob = default_prob.apply_scale (1, 2);
@@ -2359,6 +2362,7 @@ switch_decision_tree::emit_case_nodes (basic_block bb, tree index,
 	     right_prob = node->m_right->m_c->m_subtree_prob;
 	  p = ((right_prob + default_prob.apply_scale (1, 2))
 	       / (node->m_c->m_subtree_prob + default_prob));
+	  test_bb->count = bb->count.apply_probability (p);
 
 	  bb = emit_cmp_and_jump_insns (bb, index, node->m_c->get_high (),
 					GT_EXPR, test_bb, p, loc);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-25 16:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 16:00 [gcc(refs/users/marxin/heads/switch-lowering-fix-profile)] Fix first part of problems Martin Liska

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).