<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Dead argument elimination does not respect TCK_MustTail attribute"
   href="https://llvm.org/bugs/show_bug.cgi?id=27294">27294</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Dead argument elimination does not respect TCK_MustTail attribute
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter@trailofbits.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>