public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/103227] [12 Regression] 58% exchange2 regression with -Ofast -march=native on zen3 since r12-5223-gecdf414bd89e6ba251f6b3f494407139b4dbae0e
Date: Wed, 14 Dec 2022 00:04:35 +0000	[thread overview]
Message-ID: <bug-103227-4-aBiqwPgTK8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103227-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:4834e9360f7bf42fbeabaa20de5619e67c9fee4e

commit r13-4685-g4834e9360f7bf42fbeabaa20de5619e67c9fee4e
Author: Martin Jambor <mjambor@suse.cz>
Date:   Wed Dec 14 00:33:05 2022 +0100

    ipa: Better way of applying both IPA-CP and IPA-SRA (PR 103227)

    This is basically a better fix for PR 103227.  The one currently in
    use, rushed in late at stage3, which means that IPA-CP transformation
    simply does a replacement of default-definition of IPA-SRA-created
    scalar parameters with a constant, meant that IPA-SRA actually often
    led to creation of a bunch of unused parameters, which was rather
    ironic and sub-optimal.

    This patch rips that old way out and makes sure the clash is resolved
    at clone-materialization time.  What happens is that:

    1) IPA-SRA IPA analysis (decision) stage recognizes the clash and does
       not create a param adjustment entry for such a scalar component.

    2) Clone materialization code checks the IPA-CP transformation
       summary and when it realizes that it is removing a parameter that
       is a base for a discovered IPA-CP aggregate constant, and:

       a) the value is passed by reference, it internally records that any
          load of the value is replaced directly with the known constant
          value.  IPA-SRA will not attempt to split values passed by
          reference when there is a write to it so we know such a load
          won't be on a a LHS.

       b) the value is passed by value, there can be stores to the
          corresponding bit of the aggregate and so all accesses are
          replaced with a new decl and an assignment of the constant to
          this decl is generated at the beginning of the function.

    The new testcase contains an xfail as the patch does not fix PR 107640
    but it is one that ICEs when one is not careful about remapping
    indices of parameters, so I'd like to have it in testsuite/gcc.gd/ipa/
    even now.

    I don't think that PR 107640 should be attempted through
    ipa-param-manipulation replacements because the information is not
    really there any more and we'd either need to do the replacements
    earlier or dig deep into the clone parent info.  Instead, we should
    record somewhere that at the beginning of the function the bits of the
    global decl have known values and use that in the value numbering.
    That way we could one day encode also known constants in globals that
    do not come through parameters.

    gcc/ChangeLog:

    2022-11-11  Martin Jambor  <mjambor@suse.cz>

            PR ipa/103227
            * ipa-param-manipulation.h (class ipa_param_adjustments): Removed
            member function get_updated_index_or_split.
            (class ipa_param_body_adjustments): New overload of
            register_replacement, new member function append_init_stmts, new
            member m_split_agg_csts_inits.
            * ipa-param-manipulation.cc: Include ipa-prop.h.
            (ipa_param_adjustments::get_updated_index_or_split): Removed.
            (ipa_param_body_adjustments::register_replacement): New overload,
use
            it from the older one.
            (ipa_param_body_adjustments::common_initialization): Added the
            capability to create replacements for conflicting IPA-CP discovered
            constants.
            (ipa_param_body_adjustments::ipa_param_body_adjustments): Construct
            the new member.
            (ipa_param_body_adjustments::append_init_stmts): New function.
            * ipa-sra.cc: Include ipa-prop.h.
            (push_param_adjustments_for_index): Require IPA-CP transformation
            summary as a parameter, do not create replacements which are known
to
            have constant values.
            (process_isra_node_results): Find and pass to the above function
the
            IPA-CP transformation summary.
            * ipa-prop.cc (adjust_agg_replacement_values): Remove the
            functionality replacing IPA-SRA created scalar parameters with
            constants.  Simplify, do not require parameter descriptors, do not
            return anything.
            (ipcp_transform_function): Simplify now that
            adjust_agg_replacement_values does not change cfg.  Move definition
            and initialization of descriptors lower.
            * tree-inline.cc (tree_function_versioning): Call append_init_stmts
of
            param_body_adjs, if there are any.

    gcc/testsuite/ChangeLog:

    2022-11-11  Martin Jambor  <mjambor@suse.cz>

            PR ipa/103227
            PR ipa/107640
            * gcc.dg/ipa/pr107640-2.c: New test.

  parent reply	other threads:[~2022-12-14  0:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13 21:05 [Bug tree-optimization/103227] New: 58% exchange2 regression with -Ofast -march=native on zen3 between g:1ae8edf5f73ca5c3 and g:2af63f0f53a12a72 hubicka at gcc dot gnu.org
2021-11-13 22:00 ` [Bug ipa/103227] " hubicka at gcc dot gnu.org
2021-11-13 22:11 ` hubicka at gcc dot gnu.org
2021-11-13 22:15 ` hubicka at gcc dot gnu.org
2021-11-15  9:04 ` [Bug ipa/103227] [12 Regression] 58% exchange2 regression with -Ofast -march=native on zen3 since r12-5223-gecdf414bd89e6ba251f6b3f494407139b4dbae0e rguenth at gcc dot gnu.org
2021-11-19 18:18 ` jamborm at gcc dot gnu.org
2021-11-19 21:12 ` hubicka at kam dot mff.cuni.cz
2021-11-19 21:22 ` hubicka at gcc dot gnu.org
2021-11-19 23:21 ` jamborm at gcc dot gnu.org
2021-11-20 12:32 ` hubicka at kam dot mff.cuni.cz
2021-11-20 12:39 ` hubicka at kam dot mff.cuni.cz
2021-11-21 15:16 ` cvs-commit at gcc dot gnu.org
2021-11-23 17:02 ` jamborm at gcc dot gnu.org
2021-11-24 12:52 ` jamborm at gcc dot gnu.org
2021-11-25 17:17 ` cvs-commit at gcc dot gnu.org
2021-11-26  9:19 ` hubicka at gcc dot gnu.org
2021-11-28 18:56 ` hubicka at gcc dot gnu.org
2022-12-14  0:04 ` cvs-commit at gcc dot gnu.org [this message]
2023-08-15 15:45 ` jamborm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103227-4-aBiqwPgTK8@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).