[llvm-bugs] [Bug 36441] New: -flto invalidates musttail prerequisites

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 19 14:26:13 PST 2018


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

            Bug ID: 36441
           Summary: -flto invalidates musttail prerequisites
           Product: lld
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: fedor at indutny.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19906
  --> https://bugs.llvm.org/attachment.cgi?id=19906&action=edit
Input LLVM IR

Hello!

I'm working on a project that generates LLVM IR with lots of `musttail` calls.
As I was feeding that IR into `clang` with `-flto` option - I got following
error:

cannot guarantee tail call due to mismatched parameter counts
  %15 = musttail call fastcc i8*
@http_parser__invoke_on_complete(%http_parser_state* %0, i8* %14, i8* %2)
cannot guarantee tail call due to mismatched parameter counts
  %33 = musttail call fastcc i8*
@http_parser__invoke_on_complete(%http_parser_state* %0, i8* %32, i8* %2)
cannot guarantee tail call due to mismatched parameter counts
  %10 = musttail call fastcc i8* @http_parser__method(%http_parser_state* %0,
i8* %1, i8* %2, i32 0)
LLVM ERROR: Broken module found, compilation aborted!

Unfortunately, my attempts to reduce it to a minimal test case have so far been
unsuccessful. Thus please find in an attachment - the IR file that I'm
experiencing the problem is.

It looks like unused function parameters are somehow getting removed by LTO,
likely due to inlining. In turn, the compiler can no longer see that the
parameter count is the same.

I might be able to submit a patch to fix this problem given enough hints on
where to look at.

Thanks,
Fedor.

-- 
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/20180219/d0b5ac3d/attachment.html>


More information about the llvm-bugs mailing list