<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 - always_inline is ignored with the new pass manager"
   href="https://bugs.llvm.org/show_bug.cgi?id=46945">46945</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>always_inline is ignored with the new pass manager
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>C
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23804" name="attach_23804" title="2 cases representing the inline and dead code elimination issues.">attachment 23804</a> <a href="attachment.cgi?id=23804&action=edit" title="2 cases representing the inline and dead code elimination issues.">[details]</a></span>
2 cases representing the inline and dead code elimination issues.

QEMU v5.0 build fails with the new pass manager:

ld.lld: error: undefined symbol: qemu_build_not_reached
<span class="quote">>>> referenced by cputlb.c:0 (/h/git/qemu/accel/tcg/cputlb.c:0)
>>>               accel/tcg/cputlb.o:(store_helper)</span >

The recent QEMU change introduces a sanity check for nested inline functions
with attribute "always_inline":
<a href="https://github.com/qemu/qemu/blob/9f1750ed68911bef069b5d9ba5cef8150972bcf1/include/qemu/compiler.h#L232">https://github.com/qemu/qemu/blob/9f1750ed68911bef069b5d9ba5cef8150972bcf1/include/qemu/compiler.h#L232</a>
<a href="https://github.com/qemu/qemu/blob/956ae3e9265fd36cb1c487cb3c868e906bd55897/accel/tcg/cputlb.c#L1962">https://github.com/qemu/qemu/blob/956ae3e9265fd36cb1c487cb3c868e906bd55897/accel/tcg/cputlb.c#L1962</a>

`objdump -t accel/tcg/cputlb.o` shows than "store_helper" is not inlined and
there is a reference to "qemu_build_not_reached".
Without the new pass manager the build passes ("store_helper" is inlined and
dead code with "qemu_build_not_reached" is eliminated).

Here are two test cases from creduce:
1. cputlb_inline.c which shows "store_helper" with "always_inline" not honored
by the new pass manager;
2. cputlb_deadcode.c - dead code is not eliminated by the new pass manager.

Steps to reproduce"
Compare `objdump -t test.o` from:
1. clang -c -O2 -o test1.o cputlb_inline.c
2. clang -c -O2 -o test2.o -fexperimental-new-pass-manager cputlb_inline.c
3. diff <(objdump -t test1.o) <(objdump -t test2.o)</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>