From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4DA7382EF1F; Mon, 14 Nov 2022 20:08:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4DA7382EF1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668456537; bh=2UcqUX0oh5ml+kNAIc7fd6BrE6BOjPuHKCiY398DhMg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jfr6nI1y5wNQJEYN5iOPPsCr7jp3Ax9YecITUoAsq6nX9y5yDHxCwtdptUi5Y7Co/ mfM+vhjmhFPdFNEKReN4XRv4jrC3zCYdaBb8Eab4AglKkidttXY9SGZ/bJ/MgjkFbU FQpxWrst4efsfGVbvODx9TUiuckV9yf6kgZqeRJs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/107690] [12/13 Regression] vectorization fails for std::ranges::transform due to IR changes Date: Mon, 14 Nov 2022 20:08:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, needs-bisection 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: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone short_desc cf_reconfirmed_on blocked everconfirmed bug_status keywords 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=3D107690 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |12.3 Summary|Regression in |[12/13 Regression] |ranges::transform |vectorization fails for |vectorization |std::ranges::transform due | |to IR changes Last reconfirmed| |2022-11-14 Blocks| |53947 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Keywords| |missed-optimization, | |needs-bisection --- Comment #2 from Andrew Pinski --- In GCC 12 before the vectorizer we have: [local count: 114863530]: _4 =3D v_2(D) + 64; _5 =3D &v_2(D)->_M_elems; if (_4 !=3D _5) goto ; [89.30%] else goto ; [10.70%] [local count: 102576004]: [local count: 958878296]: # __first1_24 =3D PHI <_11(6), &u._M_elems(5)> # __first2_25 =3D PHI <_12(6), _5(5)> _7 =3D MEM[(const int &)__first1_24]; _9 =3D *__first2_25; _10 =3D _7 + _9; *__first1_24 =3D _10; _11 =3D __first1_24 + 4; _12 =3D __first2_25 + 4; _15 =3D _4 !=3D _12; _18 =3D &MEM [(void *)&u + 64B] !=3D _11; _16 =3D _15 & _18; if (_16 !=3D 0) goto ; [89.30%] else goto ; [10.70%] [local count: 856302294]: goto ; [100.00%] But with GCC 11 we had: [local count: 114863530]: _2 =3D &MEM [(void *)v_3(D) + 64B]; _5 =3D &v_3(D)->_M_elems; goto ; [100.00%] [local count: 114863532]: =3D u; return ; [local count: 899822495]: [local count: 1014686026]: # __first1_22 =3D PHI <_11(6), &u._M_elems(2)> # __first2_23 =3D PHI <_12(6), _5(2)> # ivtmp_24 =3D PHI _7 =3D MEM[(const int &)__first1_22]; _9 =3D *__first2_23; _10 =3D _7 + _9; *__first1_22 =3D _10; _11 =3D __first1_22 + 4; _12 =3D __first2_23 + 4; ivtmp_13 =3D ivtmp_24 - 1; if (ivtmp_13 !=3D 0) goto ; [93.84%] else goto ; [6.16%] There is a missing optimization before the vectorizer which is causing the vectorizer not to know how many iterations the loop is for. I am tries tracking down which passes the IR changes to make things worse b= ut I didn't do a good at doing that. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53947 [Bug 53947] [meta-bug] vectorizer missed-optimizations=