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

--- Comment #13 from GCC 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:c06979ff95748559da0c2d3aa4eda9d5999eaaf6

commit r16-1647-gc06979ff95748559da0c2d3aa4eda9d5999eaaf6
Author: hongtao.liu <hongtao....@intel.com>
Date:   Wed Mar 5 12:25:32 2025 +0100

    Don't duplicate setup code cost when do group-candidate cost calucalution.

    -  /* Uses in a group can share setup code, so only add setup cost once. 
*/
    -  cost -= cost.scratch;

    It looks like the original code took into account avoiding double
    counting, but unfortunately cost is reset inside the follow loop which
    invalidates the upper code, and makes same setup code cost duplicated in
    each use of the group.

    The patch fix the issue. It can also improve 548.exchange_r by 6% with
    -march=x86-64-v3 -O2 due to better ivopt on EMR.

    No big performance impact for SPEC2017 on graviton4/SPR with -mcpu=native
    -Ofast -fomit-framepointer -flto=auto.

    gcc/ChangeLog:

            PR target/115842
            * tree-ssa-loop-ivopts.cc (determine_group_iv_cost_address):
            Don't recalculate inv_expr when group-candidate cost
            calucalution.

Reply via email to