From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A7173858D28; Wed, 15 Dec 2021 11:39:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A7173858D28 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:39:35 +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: cf_reconfirmed_on short_desc everconfirmed bug_status bug_severity 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:39:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103723 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-12-15 Summary|Loop invariant motion pass |zero extend not moved out |failed to remove unused |of the loop after IV-OPTS |code from loop | Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Severity|normal |enhancement --- Comment #1 from Andrew Pinski --- >For this case, the instruction `mov ecx, eax` in bb `.L3` could remov= e from loop body and could sink to '.L8' and '.L1'. Right the problem is not what you referenced in the comment #0 though, it is the following instead: _4 =3D (unsigned int) ivtmp.7_15; That is a truncate from 64bit to 32bit. There is no pass after IV-OPTS that sinks the zero extend out of the loop though. LIM on the gimple level is not doing it for some reason ... At Lim4 we have: [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 I don't know enough about LIM if it was designed to handle non stores to si= nk but maybe it should.=