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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Jambor
<jamb...@gcc.gnu.org>:

https://gcc.gnu.org/g:5aa28c8cf15cd254cc5a3a12278133b93b8b017f

commit r10-9993-g5aa28c8cf15cd254cc5a3a12278133b93b8b017f
Author: Martin Jambor <mjam...@suse.cz>
Date:   Mon Jul 19 20:18:43 2021 +0200

    ipa-sra: Fix thinko when overriding safe_to_import_accesses (PR 101066)

    The "new" IPA-SRA has a more difficult job than the previous
    not-truly-IPA version when identifying situations in which a parameter
    passed by reference can be passed into a third function and only thee
    converted to one passed by value (and possibly "split" at the same
    time).

    In order to allow this, two conditions must be fulfilled.  First the
    call to the third function must happen before any modifications of
    memory, because it could change the value passed by reference.
    Second, in order to make sure we do not introduce new (invalid)
    dereferences, the call must postdominate the entry BB.

    The second condition is actually not necessary if the caller function
    is also certain to dereference the pointer but the first one must
    still hold.  Unfortunately, the code making this overriding decision
    also happen to trigger when the first condition is not fulfilled.
    This is fixed in the following patch.

    gcc/ChangeLog:

    2021-06-16  Martin Jambor  <mjam...@suse.cz>

            PR ipa/101066
            * ipa-sra.c (class isra_call_summary): New member
            m_before_any_store, initialize it in the constructor.
            (isra_call_summary::dump): Dump the new field.
            (ipa_sra_call_summaries::duplicate): Copy it.
            (process_scan_results): Set it.
            (isra_write_edge_summary): Stream it.
            (isra_read_edge_summary): Likewise.
            (param_splitting_across_edge): Only override
            safe_to_import_accesses if m_before_any_store is set.

    gcc/testsuite/ChangeLog:

    2021-06-16  Martin Jambor  <mjam...@suse.cz>

            PR ipa/101066
            * gcc.dg/ipa/pr101066.c: New test.

    (cherry picked from commit 763121ccd908f52bc666f277ea2cf42110b3aad9)
  • [Bug ipa/101066] [10/11/12 Regr... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to