https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104466

            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=legacy -O2 --param max-inline-insns-auto=0 --param
max-inline-insns-single=0  

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=26163
[Bug 26163] [meta-bug] missed optimization in SPEC (2k17, 2k and 2k6 and 95)

Reply via email to