[LLVMbugs] [Bug 15561] New: -Os increases size because it includes -inline

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 21 09:31:03 PDT 2013


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

            Bug ID: 15561
           Summary: -Os increases size because it includes -inline
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: antoinep92 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10218
  --> http://llvm.org/bugs/attachment.cgi?id=10218&action=edit
Generates huge binary with -Os

Optimization levels -Os and -Oz are supposed to optimize for size, but they are
exactly equivalent to -O2 (as from llvm-as < /dev/null | opt -O...
-disable-output -debug-pass=Arguments)

The problem is that these optimization levels include the -inline optimization
pass which increases the executable size.

For instance, the attached file produces 40x *bigger* binary when compiled with
-Os than with -O0.

clang -Wall -std=c++11 -fconstexpr-depth=65536 -ftemplate-depth=65536 -g0 -s
-O0
> 96408 bytes (96K)

clang -Wall -std=c++11 -fconstexpr-depth=65536 -ftemplate-depth=65536 -g0 -s
-Os
> 4024472 bytes (4M)

Trying different optimization options, I found that the origin of the increased
size is (excessive?) inlining from (-inilne). Although this test-case is
extreme, I don't think -inline should be included in -Os.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130321/16fca06d/attachment.html>


More information about the llvm-bugs mailing list