[llvm-bugs] [Bug 27294] New: Dead argument elimination does not respect TCK_MustTail attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 8 11:47:17 PDT 2016


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

            Bug ID: 27294
           Summary: Dead argument elimination does not respect
                    TCK_MustTail attribute
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at trailofbits.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following function will have its argument eliminated, which ends up
producing malformed code.

    ; ModuleID = '/tmp/bug.bc'
    declare fastcc void @bar(i64)
    ; Function Attrs: noinline
    define private fastcc void @foo(i64) unnamed_addr #0 {
    entry:
      musttail call fastcc void @bar(i64 999)
      ret void
    }
    define fastcc void @baz(i64) unnamed_addr {
    entry:
      musttail call fastcc void @foo(i64 %0)
      ret void
    }
    attributes #0 = { noinline }


When optimized with -O1/-O2/-O3 , this produces invalid bitcode because @foo
doesn't use its argument, but this argument must remain in order for the
tail-call to @bar to remain valid.

The following error is reported:

    cannot guarantee tail call due to mismatched parameter counts
      musttail call fastcc void @bar(i64 999)
    LLVM ERROR: Broken function found, compilation aborted!

-- 
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/20160408/5fd2a91f/attachment.html>


More information about the llvm-bugs mailing list