From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C4A23858417; Wed, 26 Jul 2023 10:52:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C4A23858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690368728; bh=bvM49yGI0KG+Yg1NgHRqo0Q3zm6v81mHC0Bff3ctRZ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=b77PhXWwKKeHJhOtN3I23MH1SSP2DJrDy89LNx3hchNPOjlzv/9NukW0+YSwrCB07 GJv1uMWvdZy4kPCW7FLowUH82XnfdC0Gl559fnIPr6mchpd/rtIkobrdE7XN9YlgXS eWWu2nDw4Hc/Sy/519lJruUV9GI5H3CJ4JwA2W4A= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106081] missed vectorization Date: Wed, 26 Jul 2023 10:52:07 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement 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: --- 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106081 --- Comment #12 from Richard Biener --- Btw, I see we actually materialize a permute before the splat: t.c:14:24: note: node 0x5b311c0 (max_nunits=3D1, refcnt=3D2) vector(2) do= uble t.c:14:24: note: op: VEC_PERM_EXPR t.c:14:24: note: stmt 0 _1 =3D *k_50; t.c:14:24: note: stmt 1 _1 =3D *k_50; t.c:14:24: note: stmt 2 _1 =3D *k_50; t.c:14:24: note: stmt 3 _1 =3D *k_50; t.c:14:24: note: lane permutation { 0[3] 0[2] 0[1] 0[0] } t.c:14:24: note: children 0x5b30fc0 t.c:14:24: note: node 0x5b30fc0 (max_nunits=3D2, refcnt=3D1) vector(2) do= uble t.c:14:24: note: op template: _1 =3D *k_50; t.c:14:24: note: stmt 0 _1 =3D *k_50; t.c:14:24: note: stmt 1 _1 =3D *k_50; t.c:14:24: note: stmt 2 _1 =3D *k_50; t.c:14:24: note: stmt 3 _1 =3D *k_50; t.c:14:24: note: load permutation { 0 0 0 0 } this is because vect_optimize_slp_pass::get_result_with_layout doesn't seem to consider load permutations? It's the value-numbering we perform that in the end elides the redundant permute. I have the feeling something doesn't fit together exactly, during materialize () we apply the chosen layout to the partitions, then eliminate redundant permutes but we still end up with get_result_with_layout adding the above permute. I can add the same logic as I've added to change_layout_cost also to get_result_with_layout but as said, it feels like I'm missing something ...=