From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C6DDA3858D20; Fri, 5 May 2023 12:02:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6DDA3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683288170; bh=uUolGHk8yZMWyTcRR4FOmgLRFe2flgMpgtqZXAzOGFk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fgrCm9DjI/g8paWb4oj57WlnGDfFQevIH3vAxmFswd6QkKNUGMnB/MFKFAgOgrEQ6 r1dIrzol6n2fwZQdJjw7+DIyNHRaK0Orig5uyQXfCNMClJmPRbf1aIfr2FYXTCgnW4 J4v0nKxKHjSr3nlS+J9tARj8nnvyVrCoEqL8rbyA= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109747] [12/13/14 Regression] SLP cost of constructors is off Date: Fri, 05 May 2023 12:02:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone cf_gcctarget assigned_to bug_status cc everconfirmed keywords 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109747 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |12.3 Target| |x86_64-*-* i?86-*-* Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Status|UNCONFIRMED |ASSIGNED CC| |rsandifo at gcc dot gnu.org Ever confirmed|0 |1 Keywords| |missed-optimization Last reconfirmed| |2023-05-05 --- Comment #1 from Richard Biener --- A fix, and maybe exactly a step in the right direction, would be to constru= ct individual new SLP nodes for each call to record_stmt_cost from vect_prologue_cost_for_slp: /* ??? We're just tracking whether vectors in a single node are the same. Ideally we'd do something more global. */ for (unsigned int start : starts) {=20 vect_cost_for_stmt kind; if (SLP_TREE_DEF_TYPE (node) =3D=3D vect_constant_def) kind =3D vector_load; else if (vect_scalar_ops_slice { ops, start, nelt_limit }.all_same_p = ()) kind =3D scalar_to_vec; else kind =3D vec_construct; record_stmt_cost (cost_vec, 1, kind, node, vectype, 0, vect_prologue); }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 alternatively we could pass down 'start' as well. The x86 backend code could also detect the mismatch of TYPE_VECTOR_SUBPARTS * count and the number of SLP lanes (but not sure what it should do in that case). Note we can't currently meaningfully put such a split set of SLP nodes into the SLP graph, but in the end we might want to go into the direction of splitting it into individual vector ops, esp. for load/store vectorizati= on and interleaving. Short-term passing down 'start' (and only interpreting it with count is one= ?) might be easiest. Any opinions?=