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: unassignedb...@nondot.org
          Reporter: pe...@trailofbits.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to