<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 - InstCombine breaks calls of casted functions with type attributes"
   href="https://bugs.llvm.org/show_bug.cgi?id=50697">50697</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>InstCombine breaks calls of casted functions with type attributes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sean.m.bartell@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In LLVM 12.0.0, InstCombine can break call instructions of casted functions
when type attributes (byval, sret, etc.) are involved. Example input:


%struct0 = type { i32 }
%struct1 = type { float }

declare void @callee(%struct0* sret(%struct0))

define void @caller() {
  %1 = alloca %struct1
  call void bitcast (void (%struct0*)* @callee to void (%struct1*)*)(%struct1*
sret(%struct1) %1)
  unreachable
}


When run through `opt -S -instcombine`, the output is:


%struct0 = type { i32 }

declare void @callee(%struct0* sret(%struct0))

define void @caller() {
  %1 = alloca %struct0, align 8
  call void @callee(%struct0* nonnull sret(%struct1) %1)
  unreachable
}


This is invalid because the argument type (%struct0*) no longer matches the
attribute type (%struct1).</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>