From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D818A3857437; Fri, 17 Feb 2023 12:52:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D818A3857437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676638355; bh=wHPJWN2SAfrNmZ+D1LyMtu+m/0mLcpIEP5OMvF/l7D8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aiyx4aggbnbtsE0Z7p0jpA4c7wFtdY//K9ustjArwUp4cXvYx7LxwRp08sCS1N9T3 c33E7LNgHXfmH8OGGFmUElSaA9kN/bjVFvrTudGjzYLnu7G2428OxJEnb64aekPuLG vOeWtLa2YFAxg+f/Xab4V0QEh+VK9DX8YTvbuFVw= From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108351] [13 Regression] Dead Code Elimination Regression at -O3 since r13-4240-gfeeb0d68f1c708 Date: Fri, 17 Feb 2023 12:52:34 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm 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: 13.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108351 --- Comment #5 from Martin Jambor --- If you rename main to something else, like bar, and so the calls to f outside of the loop are not considered cold, you get the GCC 12 behavior. Is this reduced from a real-world problem? Because on the testcase IPA-CP actually does what I would like it to do, it iginores the first parameter because really IPA-SRA is better placed to deal with it and then does not duplicate f for the cold calls. The fact that the GCC 12 heuristics first cloned for a constant in a useless parameter in the loop and then, when removing it in the other calls, it happened to find out that those two share the same constant in the second parameter, which happened to make the function shorter, is basically luck rather than design.=