<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 - NewGVN miscompiles select undef"
href="https://bugs.llvm.org/show_bug.cgi?id=33165">33165</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>NewGVN miscompiles select undef
</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>Keywords</th>
<td>miscompilation
</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>davide@freebsd.org, dberlin@dberlin.org, llvm-bugs@lists.llvm.org, regehr@cs.utah.edu
</td>
</tr></table>
<p>
<div>
<pre>$ cat a.ll
define i2 @f(i2, i1) {
%a = xor i2 %0, -1
%b = select i1 %1, i2 %a, i2 undef
%c = and i2 %a, %b
ret i2 %c
}
$ opt -S a.ll -newgvn
define i2 @f(i2, i1) {
%a = xor i2 %0, -1
%b = select i1 %1, i2 %a, i2 undef
ret i2 %b
}
This is incorrect. Alive report:
ERROR: Mismatch in values of i2 ret_
Example:
%0 i2 = 0x2 (2, -2)
%1 i1 = 0x0 (0)
%a i2 = 0x1 (1)
%b i2 = 0x0 (0)
%c i2 = 0x0 (0)
Source value: 0x0 (0)
Target value: 0x2 (2, -2)
<a href="http://rise4fun.com/Alive/dKH">http://rise4fun.com/Alive/dKH</a>
GVN gets this right (<a href="http://rise4fun.com/Alive/n6D">http://rise4fun.com/Alive/n6D</a>):
$ opt -S a.ll -gvn
define i2 @f(i2, i1) {
%a = xor i2 %0, -1
ret i2 %a
}</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>