https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108352

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:7c9f20fcfdc2d8453df88ceb7e693debfcd678c0

commit r13-5103-g7c9f20fcfdc2d8453df88ceb7e693debfcd678c0
Author: Richard Biener <rguent...@suse.de>
Date:   Wed Jan 11 12:07:16 2023 +0100

    tree-optimization/108352 - FSM threads creating irreducible loops

    The following relaxes a heuristic that prevents creating irreducible
    loops from FSM threads not covering multi-way branches.  Instead of
    allowing threads that adhere to

          && (n_insns * (unsigned) param_fsm_scale_path_stmts
              > (m_path.length () *
                 (unsigned) param_fsm_scale_path_blocks))

    with reasoning "We also consider it worth creating an irreducible inner
loop if
    the number of copied statement is low relative to the length of the path --
    in that case there's little the traditional loop optimizer would have done
    anyway, so an irreducible loop is not so bad." that I cannot make much
    sense of the following patch changes that to only allow those after
    loop optimization and when they are (scaled) short:

          && (!(cfun->curr_properties & PROP_loop_opts_done)
              || (m_n_insns * param_fsm_scale_path_stmts
                  >= param_max_jump_thread_duplication_stmts)))

    This allows us to get rid of --param fsm-scale-path-blocks which
    previous to the bisected revision allowed an enlarged path covering
    the original allowance (but we do not consider that enlarged path
    now because enlarging it doesn't add any information).

            PR tree-optimization/108352
            * tree-ssa-threadbackward.cc
            (back_threader_profitability::profitable_path_p): Adjust
            heuristic that allows non-multi-way branch threads creating
            irreducible loops.
            * doc/invoke.texi (--param fsm-scale-path-blocks): Remove.
            (--param fsm-scale-path-stmts): Adjust.
            * params.opt (--param=fsm-scale-path-blocks=): Remove.
            (-param=fsm-scale-path-stmts=): Adjust description.

            * gcc.dg/tree-ssa/ssa-thread-21.c: New testcase.
            * gcc.dg/tree-ssa/vrp46.c: Remove --param fsm-scale-path-blocks=1.

Reply via email to