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

--- Comment #15 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:d7deee423f993bee8ee440f6fe0c9126c316c64b

commit r12-1529-gd7deee423f993bee8ee440f6fe0c9126c316c64b
Author: Martin Jambor <mjam...@suse.cz>
Date:   Wed Jun 16 13:18:46 2021 +0200

    tree-sra: Do not refresh readonly decls (PR 100453)

    When SRA transforms an assignment where the RHS is an aggregate decl
    that it creates replacements for, the (least efficient) fallback
    method of dealing with them is to store all the replacements back into
    the original decl and then let the original assignment takes its
    course.

    That of course should not need to be done for TREE_READONLY bases
    which cannot change contents.  The SRA code handled this situation
    only for DECL_IN_CONSTANT_POOL const decls, this patch modifies the
    check so that it tests for TREE_READONLY and I also looked at all
    other callers of generate_subtree_copies and added checks to another
    one dealing with the same exact situation and one which deals with it
    in a non-assignment context.

    gcc/ChangeLog:

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

            PR tree-optimization/100453
            * tree-sra.c (create_access): Disqualify any const candidates
            which are written to.
            (sra_modify_expr): Do not store sub-replacements back to a const
base.
            (handle_unscalarized_data_in_subtree): Likewise.
            (sra_modify_assign): Likewise.  Earlier, use TREE_READONLy test
            instead of constant_decl_p.

    gcc/testsuite/ChangeLog:

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

            PR tree-optimization/100453
            * gcc.dg/tree-ssa/pr100453.c: New test.

Reply via email to