From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B6A33858C2C; Tue, 4 Jan 2022 11:24:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B6A33858C2C From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103723] zero extend not sunk out of the loop after IV-OPTS in the sink pass Date: Tue, 04 Jan 2022 11:24:44 +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: rguenth 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: short_desc 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: Tue, 04 Jan 2022 11:24:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103723 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|zero extend not moved out |zero extend not sunk out of |of the loop after IV-OPTS |the loop after IV-OPTS in | |the sink pass --- Comment #3 from Richard Biener --- Note there's pass_sink_code after IVOPTs which is what is designed to perfo= rm sinking. That is probably confused by seeing [local count: 1014686026]: # ivtmp.7_15 =3D PHI _4 =3D (unsigned int) ivtmp.7_15; _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]: [local count: 114863531]: # len_test_14 =3D PHI return len_test_14; where it doesn't consider inserting on edges because usually the pred works fine but here it's a no-op sink and splitting the edge might be profitable because its a loop exit. So the sinking pass needs tweaking for such case (but _not_ split the edge in case the PHI use is on a simple merge)=