[llvm-bugs] [Bug 50045] New: unnamed_addr wrapper function not removed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 20 13:04:58 PDT 2021


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

            Bug ID: 50045
           Summary: unnamed_addr wrapper function not removed
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvm-bugs at lists.llvm.org

Testcase:


@foo = global void ()* @bar

declare void @baz();

define internal void @bar() unnamed_addr {
    tail call void @baz()
    ret void
}


I would expect this to be optimized to:


@foo = global void ()* @baz

declare void @baz();


... but it is not. This comes up in C++ for cases such as:

void f();
auto *p = +[]{ f(); }

... where the language rules permit marking the static invoker for the lambda
as unnamed_addr -- the only constraints are on the behavior of the returned
pointer, not on its valid. (Clang doesn't do this yet.)

-- 
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/20210420/3820bde9/attachment.html>


More information about the llvm-bugs mailing list