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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

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

commit r16-3202-gdf9635322ab8f1297f3774d38a59e13cee4ae79b
Author: Andrew Pinski <andrew.pin...@oss.qualcomm.com>
Date:   Tue Aug 12 23:31:15 2025 -0700

    forwprop: Limit alias walk in some cases [PR121474]

    https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692091.html
    pointed out:
    '''
    Oh, as we now do alias walks in forwprop maybe we should make this
    conditional and do
    this not for all pass instances, since it makes forwprop possibly a lot
slower?
    '''

    This does patch limits the walk in a few different ways.
    First only allow for a full walk in the first 2 forwprop (the one before
inlining
    and the one after inlining).  The other 2 forwprop are less likely to find
any extra
    zero prop so limit them so there is no walk.

    There is an exception to the rule though, allowing to skip over clobbers
still since those
    will not take a long time for the walk and from when looking at benchmarks
the only place
    where forwprop3/4 would cause a zero prop.

    The other thing is limit a full walk only if flag_expensive_optimizations
is true.
    This limits the walk for -O1 since flag_expensive_optimizations is turned
on at -O2+.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/121474
    gcc/ChangeLog:

            * passes.def: Update forwprop1/2 to have full_walk to be true.
            * tree-ssa-forwprop.cc (optimize_aggr_zeroprop): Add new argument
            full_walk. Take into account the full_walk and clobbers at the end
            of the limit can be done always.
            (simplify_builtin_call): Add new argument, full_walk.
            Update call to optimize_aggr_zeroprop.
            (pass_forwprop): Add m_full_walk field.
            (pass_forwprop::set_pass_param): Update for m_full_walk.
            (pass_forwprop::execute): Update call to simplify_builtin_call
            and optimize_aggr_zeroprop.

    Signed-off-by: Andrew Pinski <andrew.pin...@oss.qualcomm.com>

Reply via email to