On 1/26/22 04:11, Martin Liška wrote:
Hello.

Right now, switch lowering does not update basic_block::count values
so that they are uninitiliazed. Moreover, I've updated probability scaling
when a more complex expansion happens. There are still some situations where the profile is a bit imprecise, but the patch improves rapidly the current situation.

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

Ready to be installed?
Thanks,
Martin

     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.
Funny you just ping'd this patch. I've held it in my queue for months as I didn't see it get installed.

As far as I'm concerned, you know the switch conversion bits better than anyone. If you think the patch significantly improves the profile handling for switch conversion, then I'd say go for it. Particularly since it seems to fix at least two known bugs.


Keff

Reply via email to