From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B39AD3858D28; Wed, 9 Feb 2022 13:53:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B39AD3858D28 From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104466] New: Inlining functions with restrict parameters can inhibit lim (e.g. in 554.roms_r) Date: Wed, 09 Feb 2022 13:53:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter blocked target_milestone cf_gcchost cf_gcctarget Message-ID: 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, 09 Feb 2022 13:53:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104466 Bug ID: 104466 Summary: Inlining functions with restrict parameters can inhibit lim (e.g. in 554.roms_r) Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jamborm at gcc dot gnu.org Blocks: 26163 Target Milestone: --- Host: x86_64-linux Target: x86_64-linux We have noticed that a bit more performance can be squeezed out of 554.roms_r benchmark from the SPEC 2017 FPrate suite by using option -fno-inline-functions-called-once, even at -O2 (but also at -Ofast). At least one potential reason is that without inlining, loop invariant motion is able to disambiguate memory references better because of restrict qualified parameters. When it cannot, it can be observed by lim not taking place, at -O2 at least (which in turn affects other passes). I tried to create a small-ish reproducer and am attaching the result. Compile with: -std=3Dlegacy -O2 --param max-inline-insns-auto=3D0 --param max-inline-insns-single=3D0=20=20 with and without -fno-inline-functions-called-once and look for lim of a load from array n in the lim2 dump. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D26163 [Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95= )=