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

--- Comment #10 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:0f5afb626381d19bfced30bc19cf3b03867fa6f5

commit r12-5439-g0f5afb626381d19bfced30bc19cf3b03867fa6f5
Author: Jan Hubicka <j...@suse.cz>
Date:   Sun Nov 21 16:15:41 2021 +0100

    Improve base tracking in ipa-modref

    on exchange2 benchamrk we miss some useful propagation because modref gives
    up very early on analyzing accesses through pointers.  For example in
    int test (int *a)
    {
      int i;
      for (i=0; a[i];i++);
      return i+a[i];
    }

    We are not able to determine that a[i] accesses are relative to a.
    This is because get_access requires the SSA name that is in MEM_REF to be
    PARM_DECL while on other places we use ipa-prop helper to work out the
proper
    base pointers.

    This patch commonizes the code in get_access and parm_map_for_arg so both
    use the check properly and extends it to also figure out that newly
allocated
    memory is not a side effect to caller.

    gcc/ChangeLog:

    2021-11-21  Jan Hubicka  <hubi...@ucw.cz>

            PR ipa/103227
            * ipa-modref.c (parm_map_for_arg): Rename to ...
            (parm_map_for_ptr): .. this one; handle static chain and calls to
            malloc functions.
            (modref_access_analysis::get_access): Use parm_map_for_ptr.
            (modref_access_analysis::process_fnspec): Update.
            (modref_access_analysis::analyze_load): Update.
            (modref_access_analysis::analyze_store): Update.

    gcc/testsuite/ChangeLog:

    2021-11-21  Jan Hubicka  <hubi...@ucw.cz>

            PR ipa/103227
            * gcc.dg/tree-ssa/modref-15.c: New test.

Reply via email to