[LLVMbugs] [Bug 1523] NEW: trivial functions not inlined at -O2

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jun 20 20:34:08 PDT 2007


           Summary: trivial functions not inlined at -O2
           Product: tools
           Version: 2.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org

This code isn't getting inlined at -O2:

int add (int x, int y);
int add (int x, int y) {
    return x + y;
int embeddedFunction (int x, int y);
int embeddedFunction (int x, int y) {
    return add(x,y);
int recursiveFunction (int x, int y);
int recursiveFunction (int x, int y) {
    return add(add(x,y),y);

I don't follow the code in llvm-backend.cpp:

    if (optimize > 1) {
      if (flag_inline_trees > 1)                // respect -fno-inline-functions
        PM->add(createFunctionInliningPass());  // Inline small functions
      if (flag_unit_at_a_time && !lang_hooks.flag_no_builtin())
        PM->add(createSimplifyLibCallsPass());  // Library Call Optimizations

      if (optimize > 2)
        PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args

Maybe flag_inline_trees should be >= 1 ?


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list