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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuho...@gcc.gnu.org>:

https://gcc.gnu.org/g:dbde384bd56f07bfbcae86f81fc74aa92e3786ad

commit r14-4834-gdbde384bd56f07bfbcae86f81fc74aa92e3786ad
Author: liuhongt <hongtao....@intel.com>
Date:   Wed Oct 18 10:08:24 2023 +0800

    Avoid compile time hog on vect_peel_nonlinear_iv_init for nonlinear
induction vec_step_op_mul when iteration count is too big.

    There's loop in vect_peel_nonlinear_iv_init to get init_expr *
    pow (step_expr, skip_niters). When skipn_iters is too big, compile time
    hogs. To avoid that, optimize init_expr * pow (step_expr, skip_niters) to
    init_expr << (exact_log2 (step_expr) * skip_niters) when step_expr is
    pow of 2, otherwise give up vectorization when skip_niters >=
    TYPE_PRECISION (TREE_TYPE (init_expr)).

    Also give up vectorization when niters_skip is negative which will be
    used for fully masked loop.

    gcc/ChangeLog:

            PR tree-optimization/111820
            PR tree-optimization/111833
            * tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): Give
            up vectorization for nonlinear iv vect_step_op_mul when
            step_expr is not exact_log2 and niters is greater than
            TYPE_PRECISION (TREE_TYPE (step_expr)). Also don't vectorize
            for nagative niters_skip which will be used by fully masked
            loop.
            (vect_can_advance_ivs_p): Pass whole phi_info to
            vect_can_peel_nonlinear_iv_p.
            * tree-vect-loop.cc (vect_peel_nonlinear_iv_init): Optimize
            init_expr * pow (step_expr, skipn) to init_expr
            << (log2 (step_expr) * skipn) when step_expr is exact_log2.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr111820-1.c: New test.
            * gcc.target/i386/pr111820-2.c: New test.
            * gcc.target/i386/pr111820-3.c: New test.
            * gcc.target/i386/pr103144-mul-1.c: Adjust testcase.
            * gcc.target/i386/pr103144-mul-2.c: Adjust testcase.

Reply via email to