[LLVMbugs] [Bug 14363] New: Inline heuristic does not account for the number of callers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 16 10:38:29 PST 2012


             Bug #: 14363
           Summary: Inline heuristic does not account for the number of
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: spop at codeaurora.org
                CC: chandlerc at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


LLVM inlines functions without looking at how many call sites the inline
function has.

$ cat test.c
#define M D D
#define D C C C C C
#define C L L
#define L X X X X X
#define X V V
#define V I I I I I
#define I b();

extern void c(void);

static void b(void) {
  const int N = 20;
  int B[N];

  for (int i = 0; i < N; i++)
    B[i] = (10 - i) * ((i == 2) ? -i : i);

  int A[N + 5];
  for (int i = 1; i < N; i++)
    A[i] = B[i] - B[i-1];

  for (int i = 1; i < N; i++)
    if (A[i] < B[i])

void a(void) {

$ clang -O3 test.c -emit-llvm -S -o test.ll
$ wc -l test.ll
54030 test.ll

A possible solution is to add another threshold to bound the overall code size
increase due to inlining a function.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list