http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47663

           Summary: Very simple wrapper not inlined
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: rgue...@gcc.gnu.org
        ReportedBy: rgue...@gcc.gnu.org
                CC: hubi...@gcc.gnu.org


int foo0();
inline void bar0() { foo0(); }
void foobar() { bar0(); }

is not inlined at -O[12] because

;; Function foobar (foobar)

Analyzing function body size: foobar
  freq:  1000 size:  1 time: 10 bar0 ();
  freq:  1000 size:  1 time:  2 return;
    will eliminated by inlining
Overall function body time: 12-2 size: 4-3
With function call overhead time: 12-12 size: 4-4

;; Function bar0 (bar0)

Analyzing function body size: bar0
  freq:  1000 size:  2 time: 11 foo0 ();
  freq:  1000 size:  1 time:  2 return;
    will eliminated by inlining
Overall function body time: 13-2 size: 5-3
With function call overhead time: 13-12 size: 5-4

and thus

;; Function foobar (foobar)

Considering inline candidate bar0.
Not inlining: code size would grow by 1.


for some reason an unused return value in a call has a cost.

I have a patch.

Reply via email to