This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

optimization/2514: Inlining not done for simple function



>Number:         2514
>Category:       optimization
>Synopsis:       Inlining not done for simple function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 09 07:46:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Paolo Carlini
>Release:        3.1 20010408
>Organization:
>Environment:
i686, Linux2.2.19, Glibc2.2.2, Binutils 2.11
>Description:
By compiling with g++ -O2 -finline-functions the following
code snippet by Bulka & Mayhew the very simple function
calc is not inlined (as assessed by comparing with object
code and runtime behavior to the g++ -O2 case).

-----------

#include <iostream>

int calc(int a, int b)
{
  return a+b;
}

int main()
{
  int x[1000];
  int y[1000];
  int z[1000];

  for (int i=0; i<1000; ++i) {
    for (int j=0; j<1000; ++j) {
      for (int k=0; k<1000; ++k) {
	z[i]=calc(y[j], x[k]);
      }
    }
  }
}
>How-To-Repeat:
The last time I checked, a couple fo weeks ago, the
function was indeed inlined (as is by 2.95.2 - this is a
performance regression).
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]