From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 694C13858C2D; Mon, 7 Feb 2022 09:58:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 694C13858C2D From: "tnfchris at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104408] SLP discovery fails due to -Ofast rewriting Date: Mon, 07 Feb 2022 09:58:02 +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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: tnfchris at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: tnfchris at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Mon, 07 Feb 2022 09:58:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104408 --- Comment #4 from Tamar Christina --- (In reply to Richard Biener from comment #3) > match.pd just does canonicalization here. SLP discovery could handle this > in the existing swap operands or reassoc support but I guess the desire h= ere > is to pull out a Complex SLP pattern. Yes, though also to optimize the case where you don't have the optab, curre= ntly the generated code is much worse at -Ofast. >=20 > So - no perfect idea yet how to reliably match a Complex pattern here but > trying to attack this from the match.pd side sounds wrong. Well the problem is that the scalar code is suboptimal too. even without matching a complex pattern, so the epilogue here does an extra sub on each unrolled step. So I initially figured we'd want to not perform the canonization if it's co= ming at the expense of sharing. However that looks harder than I though at first= as there are multiple points in const-fold.c that will try and force this form. I can probably fix the epilogue post vectorization but that seemed like a w= orse solution.=