<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 about type casting BinaryOperator when reordering shuffle and binary operation"
href="http://llvm.org/bugs/show_bug.cgi?id=19737">19737</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Assertion failure about type casting BinaryOperator when reordering shuffle and binary operation
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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 related to 19717 and 19730.
The CreateBinOpAsGiven() assumes that CreateBinOp will return a BinaryOperator
type. But when two operands are Constant, it may optimize the result and just
return a Constant. As a result, there is a type cast assertion failure.
To reproduce with following case test.ll:
---------------------------------------------------------------------------------
define i32 @test(<4 x i32> %in0) {
entry:
%shuffle.i = shufflevector <4 x i32> zeroinitializer, <4 x i32> %in0, <4 x
i32> <i32 0, i32 4, i32 2, i32 6>
%neg.i = xor <4 x i32> %shuffle.i, <i32 -1, i32 -1, i32 -1, i32 -1>
%and.i = and <4 x i32> %in0, %neg.i
%0 = extractelement <4 x i32> %and.i, i32 0
ret i32 %0
}
---------------------------------------------------------------------------------
To run as following:
$ opt -S -instcombine test.ll
opt: llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X,
Y*>::ret_type llvm::cast(Y*) [with X = llvm::BinaryOperator; Y = llvm::Value;
typename llvm::cast_retty<X, Y*>::ret_type = llvm::BinaryOperator*]: Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Note that not only XOR, creating other binary operation may also result into
Constant type instead of a BinaryOperator.
Thanks,
-Hao</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>