<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 - incorrect instcombine fold for icmp sgt"
href="https://bugs.llvm.org/show_bug.cgi?id=42198">42198</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>incorrect instcombine fold for icmp sgt
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>nunoplopes@sapo.pt
</td>
</tr>
<tr>
<th>CC</th>
<td>lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu
</td>
</tr></table>
<p>
<div>
<pre>The following instcombine rewrite seems incorrect
(test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll):
define i1 @cv0_GOOD(i8 %y) {
%0:
%x = call i8 @gen8()
%tmp0 = lshr i8 255, %y
%tmp1 = and i8 %tmp0, %x
%ret = icmp sgt i8 %x, %tmp1
ret i1 %ret
}
=>
define i1 @cv0_GOOD(i8 %y) {
%0:
%x = call i8 @gen8()
%tmp0 = lshr i8 255, %y
%1 = icmp sgt i8 %x, %tmp0
ret i1 %1
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
i8 %y = #x00 (0)
Source:
i8 %x = #x7f (127, -129)
i8 %tmp0 = #xff (255, -1)
i8 %tmp1 = #x7f (127, -129)
i1 %ret = #x0 (0)
Target:
i8 %x = #x7f (127, -129)
i8 %tmp0 = #xff (255, -1)
i1 %1 = #x1 (1)
Source value: #x0 (0)
Target value: #x1 (1)</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>