From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B31113865488; Wed, 22 May 2024 07:13:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B31113865488 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716362005; bh=e0l+00ou3QSsAArjAgVV/cHDOsuXr7os95d1nWE6lyU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wFojaImRpBA8OetfT+aI46AzbDzJmyFvrK9i4A6BG4mLqw1TphCjUSgz0j6M7GqMx DfyFWAqCrgpaJLe3WBRVNl/JXfdat3X8/OLdzvmlpYZ/JiOJk9Je4Yre3tTZqfIrHm ywi8TngHHlmNR6zvvx1e+GlZS4uf0M1XW7IUBZfQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115144] [15 Regression] 2% performance regression for some codes with r15-518-g99b1daae18c095 Date: Wed, 22 May 2024 07:13:25 +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: 15.0 X-Bugzilla-Keywords: missed-optimization, testsuite-fail X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 15.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed assigned_to cf_reconfirmed_on bug_status 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=3D115144 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot = gnu.org Last reconfirmed| |2024-05-22 Status|UNCONFIRMED |ASSIGNED --- Comment #8 from Richard Biener --- (In reply to Hans-Peter Nilsson from comment #7) > (In reply to Richard Biener from comment #6) [...] > > I do want to play with > > sinking to the start of the else {, but without doing any lifetime anal= ysis > > I fear that's going to be worse in the average as the current location > > at least ensures we're close to the first use of the DEF we sink. >=20 > Thank you in advance and for the look this far! I haven't looked closer = at > what happens with later passes in main, but looking at the generated > assembly code, the "sinking" of a division has the eventual effect of > increasing register pressure; see the previously attached dumps. Indeed, we have originally _38 =3D _36 / _37; _39 =3D _36 % _37; r2_78 =3D (signed char) _39; where both _36 and _37 die (but _39 and _38 are live for a lot longer). We sink the _38 def across [local count: 173045540]: # iftmp.10_49 =3D PHI if (_41 >=3D iftmp.10_49) goto ; [0.00%] else goto ; [100.00%] [local count: 173045540]: r1.13_43 =3D (unsigned char) _38; which the original profile check avoided. I'll note the above is a more sensible case where to avoid such sinking but I'll also note that sinking does not look at register pressure (or basically whether a sinking increases or decreases register pressure) at all and generally GIMPLE passes are not supposed to do this (it's also not an easy feat).=