On 12/18/20 6:19 AM, Martin Liška wrote:
> The patch covers 2 cases mentioned in the PR.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
>     PR tree-optimization/94779
>     * tree-switch-conversion.c (switch_conversion::switch_conversion):
>     Initialize m_default_unreachable, m_missing_return_in_default
>     and m_inbound_check_needed.
>     (switch_conversion::collect): Start with first edge also
>     if m_default_unreachable or m_missing_return_in_default.
>     (switch_conversion::check_all_empty_except_final): Ignore
>     default edge for case where m_default_unreachable is true.
>     (switch_conversion::phi_leads_to_return): New.
>     (switch_conversion::build_one_array): Drop boundary
>     check for linear transformation where
>     m_missing_return_in_default is true
>     (switch_conversion::analyze_default_bb): New.
>     (switch_conversion::gen_inbound_check): Generate if TRUE when
>     m_default_unreachable or we don't need boundary check.
>     (switch_conversion::expand): Do transformation as we can't be
>     sure that the switch will be expanded with JT.
>     * tree-switch-conversion.h: Declare new functions and
>     variables.
>
> gcc/testsuite/ChangeLog:
>
>     PR tree-optimization/94779
>     * gcc.dg/tree-ssa/cswtch-6.c: New test.
>     * gcc.dg/tree-ssa/cswtch-7.c: New test.
Given this is "just" a missed optimization, are we deferring to gcc-12?

jeff

Reply via email to