<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] icmp not pushed through shufflevector"
href="https://bugs.llvm.org/show_bug.cgi?id=44588">44588</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[InstCombine] icmp not pushed through shufflevector
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>enhancement
</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>nikita.ppv@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>Instcombine pushes binary operations through shufflevector instructions,
however the same does not happen with icmps:
define <2 x i1> @test(i64 %X) {
%.splatinsert = insertelement <2 x i64> undef, i64 %X, i32 0
%.splat = shufflevector <2 x i64> %.splatinsert, <2 x i64> undef, <2 x i32>
zeroinitializer
%A.idx = mul nsw <2 x i64> %.splat, <i64 4, i64 4>
%A.offs = add <2 x i64> %A.idx, <i64 4, i64 4>
%C = icmp eq <2 x i64> %A.offs, <i64 4, i64 4>
ret <2 x i1> %C
}
opt -instcombine
define <2 x i1> @test(i64 %X) {
%.splatinsert = insertelement <2 x i64> undef, i64 %X, i32 0
%1 = shl <2 x i64> %.splatinsert, <i64 2, i64 undef>
%2 = add <2 x i64> %1, <i64 4, i64 undef>
%A.offs = shufflevector <2 x i64> %2, <2 x i64> undef, <2 x i32>
zeroinitializer
%C = icmp eq <2 x i64> %A.offs, <i64 4, i64 4>
ret <2 x i1> %C
}
This means that the add+eq pair that would normally get folded ends up
separated by a shufflevector.
(As a side-note, it seems like there's an opportunity here to push instructions
through insertelement if the other lanes are undef anyway.)</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>