<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - NPM inliner does not perform alloca merging"
   href="https://bugs.llvm.org/show_bug.cgi?id=47909">47909</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>NPM inliner does not perform alloca merging
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>alina.sbirlea@gmail.com, davidxl@google.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, rnk@google.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>46649
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The NPM inliner does not perform alloca merging. Lifetimes can help mitigate
the issue of not reusing stack slots when inlining multiple functions, but they
are not emitted at -O0. If we have something like

void a(void*);

 __attribute__((always_inline)) void b() {
        long long l[10000];
        a(l);
}

void c() {
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
        b();
}

the stack usage in c() is much much larger under the NPM than in the legacy PM
under -O0.

<a href="https://godbolt.org/z/bWaWvv">https://godbolt.org/z/bWaWvv</a></pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Change default pass manager to new pass manager"
   href="https://bugs.llvm.org/show_bug.cgi?id=46649">Bug 46649</a>] Change default pass manager to new pass manager
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>