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

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

https://gcc.gnu.org/g:3305135c29e1c3e988bd9bad40aefc01d138aaca

commit r12-5960-g3305135c29e1c3e988bd9bad40aefc01d138aaca
Author: Jan Hubicka <j...@suse.cz>
Date:   Tue Dec 14 16:50:27 2021 +0100

    Determine global memory accesses in ipa-modref

    As discussed in PR103585, fatigue2 is now only benchmark from my usual
testing
    set (SPEC2k6, SPEC2k17, CPP benchmarks, polyhedron, Firefox, clang) which
sees
    important regression when inlining functions called once is limited.  This
    prevents us from solving runtime issues in roms benchmarks and elsewhere.

    The problem is that there is perdida function that takes many arguments and
    some of them are array descriptors.  We constant propagate most of their
fields
    but still keep their initialization. Because perdida is quite fast, the
call
    overhead dominates, since we need over 100 memory stores consuing about 35%
    of the overall benchmark runtime.

    The memory stores would be eliminated if perdida did not call fortran I/O
which
    makes modref to thin that the array descriptors could be accessed. We are
    quite close discovering that they can't becuase they are non-escaping from
    function.  This patch makes modref to distingush between global memory
access
    (only things that escapes) and unkonwn accesss (that may access also
    nonescaping things reaching the function).  This makes disambiguation for
    functions containing error handling better.

    Unfortunately the patch hits two semi-latent issues in Fortran frontned.
    First is wrong code in gfortran.dg/unlimited_polymorphic_3.f03. This can be
    turned into wrong code testcase on both mainline and gcc11 if the runtime
    call is removed, so I filled PR 103662 for it. There is TBAA mismatch for
    structure produced in FE.

    Second is issue with GOMP where Fortran marks certain parameters as
non-escaping
    and then makes them escape via GOMP_parallel.  For this I disabled the use
of
    escape info in verify_arg which also disables the useful transform on
perdida
    but still does useful work for e.g. GCC error handling.  I will work on
this
    incrementally.

    Bootstrapped/regtested x86_64-linux, lto-bootstrapped and also tested with
    clang build.  I plan to commit this tomorrow if there are no complains
    (the patch is not completely short but conceptualy simple and handles a lot
    of common cases).

    gcc/ChangeLog:

    2021-12-12  Jan Hubicka  <hubi...@ucw.cz>

            PR ipa/103585
            * ipa-modref-tree.c (modref_access_node::range_info_useful_p):
Handle
            MODREF_GLOBAL_MEMORY_PARM.
            (modref_access_node::dump): Likewise.
            (modref_access_node::get_call_arg): Likewise.
            * ipa-modref-tree.h (enum modref_special_parms): Add
            MODREF_GLOBAL_MEMORY_PARM.
            (modref_access_node::useful_for_kill): Handle
            MODREF_GLOBAL_MEMORY_PARM.
            (modref:tree::merge): Add promote_unknown_to_global.
            * ipa-modref.c (verify_arg):New function.
            (may_access_nonescaping_parm_p): New function.
            (modref_access_analysis::record_global_memory_load): New member
            function.
            (modref_access_analysis::record_global_memory_store): Likewise.
            (modref_access_analysis::process_fnspec): Distingush global and
local
            memory.
            (modref_access_analysis::analyze_call): Likewise.
            * tree-ssa-alias.c (ref_may_access_global_memory_p): New function.
            (modref_may_conflict): Use it.

    gcc/testsuite/ChangeLog:

    2021-12-12  Jan Hubicka  <hubi...@ucw.cz>

            * gcc.dg/analyzer/data-model-1.c: Disable ipa-modref.
            * gcc.dg/uninit-38.c: Likewise.
            * gcc.dg/uninit-pr98578.c: Liewise.

Reply via email to