From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D22E3839C42; Wed, 16 Jun 2021 11:24:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D22E3839C42 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100453] [12 Regression] wrong code at -O1 and above since r12-434 Date: Wed, 16 Jun 2021 11:24:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2021 11:24:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100453 --- Comment #15 from CVS Commits --- The master branch has been updated by Martin Jambor : https://gcc.gnu.org/g:d7deee423f993bee8ee440f6fe0c9126c316c64b commit r12-1529-gd7deee423f993bee8ee440f6fe0c9126c316c64b Author: Martin Jambor 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 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 PR tree-optimization/100453 * gcc.dg/tree-ssa/pr100453.c: New test.=