From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DB4553858D34; Tue, 31 Aug 2021 01:24:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DB4553858D34 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102139] [11/12 Regression] -O3 miscompile due to slp-vectorize on strict align target Date: Tue, 31 Aug 2021 01:24:25 +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: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status target_milestone everconfirmed short_desc cf_reconfirmed_on 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: Tue, 31 Aug 2021 01:24:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102139 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Target Milestone|--- |11.3 Ever confirmed|0 |1 Summary|-O3 miscompile due to |[11/12 Regression] -O3 |slp-vectorize on strict |miscompile due to |align target |slp-vectorize on strict | |align target Last reconfirmed| |2021-08-31 --- Comment #3 from Andrew Pinski --- fre is fine here. The problem is SLP. Here is why take: typedef decltype(sizeof(0)) size_t; typedef unsigned short uint16_t; typedef unsigned uint32_t; void zero_two_uint16(uint16_t* ptr) { ptr[0] =3D 0; ptr[1] =3D 0; } #define vector __attribute__((vector_size(sizeof(uint16_t)*4))) void f(uint16_t *a) { vector uint16_t *b =3D (vector uint16_t *)a; *b =3D (vector uint16_t){}; } void g(uint16_t *a) { size_t t =3D (size_t)a; if ((t & 0x7)=3D=3D0) { for(int i =3D 0;i < 8;i++) f((a + i*4)); } else { for(int i =3D 0;i < 16;i++) zero_two_uint16((a + i*2)); } } ---- CUT ---- Compile it on aarch64 with -O3 -mgeneral-regs-only -fno-tree-loop-distribute-patterns -mstrict-align -fno-tree-loop-vectorize and you will produce the same result for SLP. There is no PHI for a for FRE to merge even. And there is no alignment information on the pointers assignments either. As you can see by the dump (-fdump-tree-*-all): # PT =3D nonlocal null=20 uint16_tD.1724 * a_15(D) =3D aD.1733;=