A comment regarding the bit test finding algorithm says that the
algorithm "...tries to end up with as few clusters as possible". It not
only tries, it actually achieves the fewest possible clusters. For
people reading this code, I think it is more helpful to state that the
algorithm is optimal in this regard. That's what this patch addresses.
Committing as obvious.
gcc/ChangeLog:
* tree-switch-conversion.cc (bit_test_cluster::find_bit_tests):
State that the bit test algorithm is optimal.
Signed-off-by: Filip Kastl <[email protected]>
---
gcc/tree-switch-conversion.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index f3e77647daa..16564e5ee01 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -1803,8 +1803,9 @@ bit_test_cluster::find_bit_tests (vec<cluster *>
&clusters, int max_c)
Out: List of simple clusters and bit test clusters such that each bit test
cluster can_be_handled() and is_beneficial()
- Tries to merge consecutive clusters into bigger (bit test) ones. Tries to
- end up with as few clusters as possible. */
+ Merges consecutive clusters into bigger (bit test) clusters. Produces the
+ optimal solution -- the number of clusters in the output list is
+ minimal. */
unsigned l = clusters.length ();
--
2.55.0