From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 718FB3858C55; Wed, 21 Sep 2022 00:42:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 718FB3858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663720968; bh=2AaQ1SJtnDoj7bqKNpFZo+Ys/I3mcgv1qO5y90x9Iu8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=W5hJ5XUZW/Ot01WCAEguXrtzsSPkeWRAlugaRly64QQem/VB9AoE9JV3Ft623oiZk YYokUVzjzhy3tfV4doD9RjBBO69N0JE5R/qJ2WdLjTzSnB+cJlSd/6KC0a74Zfgdyj 57Ka1lZuZCoIVy4Ra8abmZxC0H+niHX4nvqI3h9A= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106989] GCC fail to vectorize and clang succeed Date: Wed, 21 Sep 2022 00:42:48 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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=3D106989 --- Comment #2 from Andrew Pinski --- /app/example.cpp:20:25: note: Detected interleaving store a[i_27] and a[i= _27] /app/example.cpp:20:25: note: Queuing group with duplicate access for fix= up /app/example.cpp:20:25: note: zero step in outer loop. /app/example.cpp:20:25: note: zero step in outer loop. /app/example.cpp:20:25: missed: not vectorized: complicated access patter= n. /app/example.cpp:22:18: missed: not vectorized: complicated access patter= n. /app/example.cpp:20:25: missed: bad data access. ... /app/example.cpp:21:27: note: dependence distance =3D 0. /app/example.cpp:21:27: note: dependence distance =3D=3D 0 between b[i_27= ] and b[i_27] /app/example.cpp:21:27: note: dependence distance =3D 1. /app/example.cpp:22:18: missed: not vectorized, possible dependence betwe= en data-refs a[i_27] and a[_9] /app/example.cpp:21:27: missed: bad data dependence. /app/example.cpp:21:27: note: ***** Analysis failed with vector mode V4SF There is a missing DSE before hand: # VUSE <.MEM_28> _1 =3D bD.3768[i_27]; # VUSE <.MEM_28> _2 =3D cD.3769[i_27]; # VUSE <.MEM_28> _3 =3D dD.3770[i_27]; _4 =3D _2 * _3; _5 =3D _1 + _4; # .MEM_19 =3D VDEF <.MEM_28> aD.3767[i_27] =3D _5; # VUSE <.MEM_19> _6 =3D eD.3771[i_27]; _7 =3D _3 * _6; _8 =3D _5 + _7; # .MEM_20 =3D VDEF <.MEM_19> bD.3768[i_27] =3D _8; # RANGE [irange] int [1, 31999] NONZERO 0x7fff _9 =3D i_27 + 1; # VUSE <.MEM_20> _10 =3D aD.3767[_9]; _11 =3D _3 * _10; _12 =3D _8 + _11; # .MEM_21 =3D VDEF <.MEM_20> aD.3767[i_27] =3D _12; DSE does not notice the store defining MEM_19 does touch the load: # VUSE <.MEM_20> _10 =3D aD.3767[_9]; And that it is redudent with the store defining MEM_21.=