[Bug ipa/108226] __restrict on inlined function parameters does not function as expected

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 9 13:54:28 GMT 2023


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
          Component|tree-optimization           |ipa
   Last reconfirmed|                            |2023-01-09

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
For the first case it's the order of inlining - we first inline Func2 into
Func3 early and only then inline Func1 at IPA time which fails to put the Func1
accesses under __restrict.

For the second case it's with __restrict:

> ./cc1 -quiet t.c -O2 -fopt-info -fdump-tree-all
t.c:27:3: optimized:  Inlining Func2/2 into Func3/3.
t.c:22:3: optimized:  Inlined Func1.isra/5 into Func3/3 which now has time
12.500000 and size 21, net change of -7.

vs without

> ./cc1 -quiet t.c -O2 -fopt-info -fdump-tree-all
t.c:27:3: optimized:  Inlining Func2/2 into Func3/3.
t.c:22:3: optimized:  Inlined Func1.constprop.isra/6 into Func3/3 which now has
time 4.375000 and size 7, net change of -21.

so somehow the restrict qualification pessimizes IPA-CP?!  Martin?

Note with restrict it's again the first issue.  -fno-early-inlining helps
there.


More information about the Gcc-bugs mailing list