<html>
    <head>
      <base href="https://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 --- - llvm missing opportunities to overlap non-interfering local variables"
   href="https://llvm.org/bugs/show_bug.cgi?id=25776">25776</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm missing opportunities to overlap non-interfering local variables
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>thanm@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15416" name="attach_15416" title="stack-ifthen.cc">attachment 15416</a> <a href="attachment.cgi?id=15416&action=edit" title="stack-ifthen.cc">[details]</a></span>
stack-ifthen.cc

When I compile the attached testcase "stack-ifthen.cc" with "clang++ -g -O"
using LLVM trunk (linux x86-64), I observe that the size of the stack frame is
larger than it needs to be (~1024 bytes).

Compiling with "g++-4.8 -g -O" yields a stack frame size of ~512 bytes; gcc is
able to recognize that the two local arrays can share the same stack space.
Clang/llvm creates a separate stack allocation for each array, resulting in a
larger stack frame size.

Interestingly, gcc/g++ appears to overlap the two arrays even when compiling
with -O0, which leads me to assume the layout is being done in the front end as
opposed to in the back end.</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>