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]
Other format: [Raw text]

[Bug tree-optimization/34708] New: Inlining heuristics issue


openbabel doesn't build on ppc64-linux with 4.3 (works with 4.1), with
-mminimal-toc -O2 -fPIC .toc1 section overflows (is bigger than 64KB).
About 2/3 of .toc1 entries are as with 4.1 various pointers to .rodata.str1.8
(i.e. string literals), but newly there are over 3600 pointers into .text.

This comes down to:

static __attribute__ ((__unused__)) const char*
SWIG_Perl_ErrorType(int code) {
  const char* type = 0;
  switch(code) {
  case -12:
    type = "MemoryError";
    break;
  case -2:
    type = "IOError";
    break;
  case -3:
    type = "RuntimeError";
    break;
  case -4:
    type = "IndexError";
    break;
  case -5:
    type = "TypeError";
    break;
  case -6:
    type = "ZeroDivisionError";
    break;
  case -7:
    type = "OverflowError";
    break;
  case -8:
    type = "SyntaxError";
    break;
  case -9:
    type = "ValueError";
    break;
  case -10:
    type = "SystemError";
    break;
  case -11:
    type = "AttributeError";
    break;
  default:
    type = "RuntimeError";
  }
  return type;
}

extern "C" int puts (const char *);

void f1 (int code)
{
  puts (SWIG_Perl_ErrorType (code));
}

void f2 (int code)
{
  puts (SWIG_Perl_ErrorType (code));
}

void f3 (int code)
{
  puts (SWIG_Perl_ErrorType (code));
}

void f4 (int code)
{
  puts (SWIG_Perl_ErrorType (code));
}

void f5 (int code)
{
  puts (SWIG_Perl_ErrorType (code));
}

where 4.1 doesn't inline the SWIG_Perl_ErrorType function at -O2, but 4.3 does
because of -finline-small-functions.  SWIG_Perl_ErrorType isn't very small
though, especially with -fPIC it is fairly expensive, a bigger SWITCH_EXPR
which needs to use a jump table and then a dozen of string literal loads.
estimate_num_insns guesses 1 though :(.


-- 
           Summary: Inlining heuristics issue
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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