<html>
    <head>
      <base href="http://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 --- - Assertion failure when reordering shuffle and binary operation"
   href="http://llvm.org/bugs/show_bug.cgi?id=19717">19717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure when reordering shuffle and binary operation
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>Hao.Liu@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This bug is introduced by the commit
<a href="http://llvm.org/viewvc/llvm-project?rev=208488&view=rev">http://llvm.org/viewvc/llvm-project?rev=208488&view=rev</a>
This patch tries to do the following transformation:
    Op(shuffle(v1, m), shuffle(v2, m)) -> shuffle(Op(v1, v2), m)

But when v1 and v2 are different types, to create Op(v1, v2) may trigger
assertions.
To reproduce with following test case simple.ll:
-------------------------------------------------------------------------------
define <2 x i32> @dotest(<4 x i32> %in0, <2 x i32> %in1) {
entry:
  %shuffle = shufflevector <4 x i32> %in0, <4 x i32> %in0, <2 x i32>
zeroinitializer
  %shuffle4 = shufflevector <2 x i32> %in1, <2 x i32> %in1, <2 x i32>
zeroinitializer
  %mul = mul <2 x i32> %shuffle, %shuffle4
  ret <2 x i32> %mul
}
-------------------------------------------------------------------------------
Run with: 
$opt -S -instcombine simple.ll

The error message is like:
opt: llvm/lib/IR/Instructions.cpp:1848: static llvm::BinaryOperator*
llvm::BinaryOperator::Create(llvm::Instruction::BinaryOps, llvm::Value*,
llvm::Value*, const llvm::Twine&, llvm::Instruction*): Assertion `S1->getType()
== S2->getType() && "Cannot create binary operator with two operands of
differing type!"' failed.</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>