On 11/9/20 4:56 PM, Jeff Law wrote:

On 11/9/20 7:24 AM, Martin Liška wrote:
Hello.

As mentioned in the PR, we used to prefer BT over JT in switch expansion.
I restore the behavior to that.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

    PR tree-optimization/97736
    * tree-switch-conversion.c
(switch_decision_tree::analyze_switch_statement):
    Prefer bit tests.

gcc/testsuite/ChangeLog:

    PR tree-optimization/97736
    * gcc.dg/tree-ssa/switch-1.c: Prefer bit tests.
    * g++.dg/tree-ssa/pr97736.C: New test.

[ ... ]


---
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 426462e856b..a7c5df31743 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -1743,8 +1743,8 @@ switch_decision_tree::analyze_switch_statement ()
Â
   reset_out_edges_aux (m_switch);
Â
-  /* Find jump table clusters.  */
-  vec<cluster *> output = jump_table_cluster::find_jump_tables
(clusters);
+  /* Find bit-test clusters.  */
+  vec<cluster *> output = bit_test_cluster::find_bit_tests (clusters);
Â
   /* Find bit test clusters.  */

                ^^^


Doesn't the "bit test clusters" need to change too?  OK with that nit fixed.

Yep, fixed that.

Btw. Jeff, I noticed your email client is sending weird 'Â' characters as can
be seen also here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558502.html

Can you please take a look?
Thanks,
Martin




jeff


Reply via email to