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

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

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

commit r12-5527-g5bc4cb04127a4805b6228b0a6cbfebdbd61314d2
Author: Martin Jambor <mjam...@suse.cz>
Date:   Thu Nov 25 17:58:12 2021 +0100

    ipa: Teach IPA-CP transformation about IPA-SRA modifications (PR 103227)

    PR 103227 exposed an issue with ordering of transformations of IPA
    passes.  IPA-CP can create clones for constants passed by reference
    and at the same time IPA-SRA can also decide that the parameter does
    not need to be a pointer (or an aggregate) and plan to convert it
    into (a) simple scalar(s).  Because no intermediate clone is created
    just for the purpose of ordering the transformations and because
    IPA-SRA transformation is implemented as part of clone
    materialization, the IPA-CP transformation happens only afterwards,
    reversing the order of the transformations compared to the ordering of
    analyses.

    IPA-CP transformation looks at planned substitutions for values passed
    by reference or in aggregates but finds that all the relevant
    parameters no longer exist.  Currently it subsequently simply gives
    up, leading to clones created for no good purpose (and huge regression
    of 548.exchange_r.  This patch teaches it recognize the situation,
    look up the new scalarized parameter and perform value substitution on
    it.  On my desktop this has recovered the lost exchange2 run-time (and
    some more).

    I have disabled IPA-SRA in a Fortran testcase so that the dumping from
    the transformation phase can still be matched in order to verify that
    IPA-CP understands the IL after verifying that it does the right thing
    also with IPA-SRA.

    gcc/ChangeLog:

    2021-11-23  Martin Jambor  <mjam...@suse.cz>

            PR ipa/103227
            * ipa-prop.h (ipa_get_param): New overload.  Move bits of the
existing
            one to the new one.
            * ipa-param-manipulation.h (ipa_param_adjustments): New member
            function get_updated_index_or_split.
            * ipa-param-manipulation.c
            (ipa_param_adjustments::get_updated_index_or_split): New function.
            * ipa-prop.c (adjust_agg_replacement_values): Reimplement, add
            capability to identify scalarized parameters and perform
substitution
            on them.
            (ipcp_transform_function): Create descriptors earlier, handle new
            return values of adjust_agg_replacement_values.

    gcc/testsuite/ChangeLog:

    2021-11-23  Martin Jambor  <mjam...@suse.cz>

            PR ipa/103227
            * gcc.dg/ipa/pr103227-1.c: New test.
            * gcc.dg/ipa/pr103227-3.c: Likewise.
            * gcc.dg/ipa/pr103227-2.c: Likewise.
            * gfortran.dg/pr53787.f90: Disable IPA-SRA.

Reply via email to