<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - GlobalOpt creates giant initializers leading to excessively large object files"
   href="http://llvm.org/bugs/show_bug.cgi?id=15402">15402</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GlobalOpt creates giant initializers leading to excessively large object files
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interprocedural Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sschiffli@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10112" name="attach_10112" title="Reduced .ll file">attachment 10112</a> <a href="attachment.cgi?id=10112&action=edit" title="Reduced .ll file">[details]</a></span>
Reduced .ll file

This appears to be an optimization bug to me where GlobalOpt sacrifices file
size at any cost.

In the example I have a large array which was originally marked as
zeroinitializer, and store to the array in the c-tor chain.  When GlobalOpt
runs it builds a very large initializer of all zeros except for the one
non-zero value written in the c-tor chain.  Which results in a very large
object file just to initialize one element of this array.  To reproduce run
globalopt on the attached file.

For reference here is the original c++

int __attribute__((used)) bob[1000000];

int foo() {
    bob[10] = 99;
    return 0;
}

int x = foo();

int main() {
    return 0;
}

I was hoping to get some general advise as to the best way to do sparse data
initialization efficiently.  It seems the ELF itself sort of limits this due to
the contiguous nature of its sections, so any ideas would be appreciated.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>