[llvm-bugs] [Bug 46945] New: always_inline is ignored with the new pass manager

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 1 02:02:05 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46945

            Bug ID: 46945
           Summary: always_inline is ignored with the new pass manager
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: denik at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 23804
  --> https://bugs.llvm.org/attachment.cgi?id=23804&action=edit
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
>>> referenced by cputlb.c:0 (/h/git/qemu/accel/tcg/cputlb.c:0)
>>>               accel/tcg/cputlb.o:(store_helper)

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

`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)

-- 
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/20200801/25097bd3/attachment.html>


More information about the llvm-bugs mailing list