[LLVMbugs] [Bug 13861] New: Very slow compilation for small static functions that are called multiple times

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 17 22:49:22 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13861

             Bug #: 13861
           Summary: Very slow compilation for small static functions that
                    are called multiple times
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: abbeyj at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9224
  --> http://llvm.org/bugs/attachment.cgi?id=9224
Example of slow compilation

The attached file is about 130 lines.  Each function calls the function at the
level below it twice.  I suspect the problem is an exponential amount of work
being done trying to inline all the function calls.

When compiling at -O2, it takes almost 3 minutes to compile (on a Core i7-2600K
at 3.4GHz) and produces a 2.75MB object file.  Moving down to -O1 makes things
nice and fast (fraction of a second) and produces a 3KB object file.  If I
comment out the R14() call at the end of foo(), the time goes down to about 40
seconds.  If I comment out R14() and R13(), the time goes down to 8 seconds.

-ftime-report shows most of the time being spent in two passes:
 Total Execution Time: 170.7743 seconds (170.8402 wall clock)

  ---User Time---   --System Time--   --User+System--   ---Wall Time---  ---
Name ---
 97.2822 ( 57.0%)   0.0000 (  0.0%)  97.2822 ( 57.0%)  97.3401 ( 57.0%)  Scalar
Replacement of Aggregates (SSAUp)
 67.8916 ( 39.8%)   0.0156 ( 16.7%)  67.9072 ( 39.8%)  67.9101 ( 39.8%)  Simple
Register Coalescing

-- 
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