From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 094293858C2C; Wed, 22 Dec 2021 15:39:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 094293858C2C From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/57955] [9/10/11/12 Regression] Uniquization of constants reduces alignment of initializers Date: Wed, 22 Dec 2021 15:39:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.6.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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, 22 Dec 2021 15:39:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D57955 --- Comment #24 from Andrew Pinski --- Just to summarize this bug as far as I read it, please correct me if I am wrong; note I am not proposing a change, just trying to summarize the back = and forth since it is not obvious right away of what the problem was. This was the testcase: void foo(void) { int x[8] __attribute__((aligned(128))) =3D { 1, 1, 1, 1, 1, 1, 1, 1 }; bar (x); } Before the gimplification change the initializer {1,....} was promoted to a static const and given an alignment of 128; due to this part of the code: if (align > DECL_ALIGN (new_tree)) { DECL_ALIGN (new_tree) =3D align; DECL_USER_ALIGN (new_tree) =3D 1; } But now it just uses DATA_ALIGNMENT (the code should be using TARGET_CONSTANT_ALIGNMENT but does not right now, that was a proposal). rs6000_constant_alignment (TARGET_CONSTANT_ALIGNMENT) only aligns strings c= sts to word (32 or 64) aligned. rs6000_data_alignment (DATA_ALIGNMENT) only ali= gns vectors to 128 and char arrays to word (32 or 64) align.=