From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 851B03858407; Wed, 15 Dec 2021 11:45:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 851B03858407 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103723] zero extend not moved out of the loop after IV-OPTS Date: Wed, 15 Dec 2021 11:45:28 +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: enhancement 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: --- 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: Wed, 15 Dec 2021 11:45:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103723 --- Comment #2 from Andrew Pinski --- Actually this is more complex, I had missed the original add too. the full loop: [local count: 958878296]: _18 =3D (unsigned int) ivtmp.7_15; len_test_12 =3D _18 + 1; ivtmp.7_7 =3D ivtmp.7_15 + 1; if (ivtmp.7_7 !=3D _21) goto ; [94.50%] else goto ; [5.50%] [local count: 52738306]: # len_test_17 =3D PHI goto ; [100.00%] [local count: 906139990]: [local count: 1014686026]: # ivtmp.7_15 =3D PHI _4 =3D (unsigned int) ivtmp.7_15; len_test_13 =3D _4; _3 =3D MEM[(const uint8_t *)buf_9(D) + ivtmp.7_15 * 1]; _6 =3D MEM[(const uint8_t *)buf_back_11(D) + ivtmp.7_15 * 1]; if (_3 =3D=3D _6) goto ; [94.50%] else goto ; [5.50%] [local count: 55807731]: # len_test_16 =3D PHI We can't just sink the cast though as that would violate the closed-loop-SS= A. We would need to sink also: _18 =3D (unsigned int) ivtmp.7_15; len_test_12 =3D _18 + 1; Which we do at the RTL level ....=