aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-01-24 15:45:38 +0100
committerMartin Liska <mliska@suse.cz>2022-11-30 14:03:43 +0100
commit4fa25a7eb322f0a003c1eb15680c71ece345e01e (patch)
tree52b4d065f5870abbf4215efc517ef2aacb84cbb0 /gcc/tree-switch-conversion.h
parentb628cad9e093f7a33042fb9dd647f183394eefae (diff)
downloadgcc-4fa25a7eb322f0a003c1eb15680c71ece345e01e.zip
gcc-4fa25a7eb322f0a003c1eb15680c71ece345e01e.tar.gz
gcc-4fa25a7eb322f0a003c1eb15680c71ece345e01e.tar.bz2
Improve profile handling in switch lowering.
PR tree-optimization/101301 PR tree-optimization/103680 gcc/ChangeLog: * tree-switch-conversion.cc (bit_test_cluster::emit): Handle correctly remaining probability. (switch_decision_tree::try_switch_expansion): Fix BB's count where a cluster expansion happens. (switch_decision_tree::emit_cmp_and_jump_insns): Fill up also BB count. (switch_decision_tree::do_jump_if_equal): Likewise. (switch_decision_tree::emit_case_nodes): Handle special case for BT expansion which can also fallback to a default BB. * tree-switch-conversion.h (cluster::cluster): Add m_default_prob probability.
Diffstat (limited to 'gcc/tree-switch-conversion.h')
-rw-r--r--gcc/tree-switch-conversion.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h
index 6861572..431cf1a 100644
--- a/gcc/tree-switch-conversion.h
+++ b/gcc/tree-switch-conversion.h
@@ -102,6 +102,10 @@ public:
/* Probability of reaching subtree rooted at this node. */
profile_probability m_subtree_prob;
+ /* Probability of default case when reaching the node.
+ It is used by bit-test right now. */
+ profile_probability m_default_prob;
+
protected:
/* Default constructor. */
cluster () {}
@@ -110,7 +114,8 @@ protected:
cluster::cluster (tree case_label_expr, basic_block case_bb,
profile_probability prob, profile_probability subtree_prob):
m_case_label_expr (case_label_expr), m_case_bb (case_bb), m_prob (prob),
- m_subtree_prob (subtree_prob)
+ m_subtree_prob (subtree_prob),
+ m_default_prob (profile_probability::uninitialized ())
{
}
@@ -545,6 +550,7 @@ public:
basic_block target_bb;
tree label;
int bits;
+ profile_probability prob;
/* Comparison function for qsort to order bit tests by decreasing
probability of execution. */