<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - early-cse is triggering lint "call argument type mismatched callee parameter type""
   href="https://bugs.llvm.org/show_bug.cgi?id=42380">42380</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>early-cse is triggering lint "call argument type mismatched callee parameter type"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>8.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>pnkfelix@pnkfx.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22136" name="attach_22136" title=".ll input to feed to -early-cse -lint passes.">attachment 22136</a> <a href="attachment.cgi?id=22136&action=edit" title=".ll input to feed to -early-cse -lint passes.">[details]</a></span>
.ll input to feed to -early-cse -lint passes.

The following .ll file when fed into the early-cse optimization, will cause the
lint pass to signal an error, "call argument type mismatched callee parameter
type"

.ll file is attached; it is also available here:
<a href="https://gist.github.com/pnkfelix/8df4508294069f1e5963c5fac7f8f825">https://gist.github.com/pnkfelix/8df4508294069f1e5963c5fac7f8f825</a>

This is spawned off of Rust bug <a href="https://github.com/rust-lang/rust/issues/48310">https://github.com/rust-lang/rust/issues/48310</a>

I do not know enough about the guarantees of the early-cse optimization nor of
the lint system to say whether this is definitively a bug in early-cse, or if
it is a bug in the lint. (One of my fellow Rust developers said it looked like
a bug in the lint, but that was, I think, based on their analysis of the .ll
file prior to LLVM's optimization passes.)


Steps to Reproduce:

1. Download .ll file, named `narrowed-48310.ll`
2. Run `opt -early-cse -lint narrowed-48310.ll`

Illustration:

% ./build/x86_64-unknown-linux-gnu/llvm/bin/opt  -early-cse  -lint -o /dev/null
narrowed-48310.ll
Undefined behavior: Call argument type mismatches callee parameter type
  invoke void bitcast (void (%Bar*)*
@"_ZN59_$LT$narrowed_48310..Bar$u20$as$u20$narrowed_48310..Foo$GT$6borrow17hdd495dfcc8d99ffcE"
to void ({}*)*)({}* align 1 %9)
          to label %bb3 unwind label %cleanup
%



(Note that above lint does not trigger without early-cse, as illustrated by the
below variant of the above command.)

% ./build/x86_64-unknown-linux-gnu/llvm/bin/opt  -lint -o /dev/null
narrowed-48310.ll
%</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>