<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 --- - gvn incorrectly changing sign of floating point zero"
href="http://llvm.org/bugs/show_bug.cgi?id=22823">22823</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>gvn incorrectly changing sign of floating point zero
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>simonbyrne@gmail.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>The following IR essentially corresponds to the statement
f(x,y) = (x==y & y==0.0) ? y : y+1.0
define double @foo(double, double) {
top:
%2 = fcmp une double %0, %1
br i1 %2, label %L3, label %L1
L1:
%3 = fcmp une double %1, 0.000000e+00
br i1 %3, label %L3, label %L2
L2:
ret double %1
L3:
%4 = fadd double %1, 1.000000e+00
ret double %4
}
A global value numbering pass incorrectly changes L2 to return the first
argument, which will give the incorrect value when the first argument is 0.0,
and the second is -0.0:
$ bin/opt -S -gvn foo.ll
; ModuleID = 'foo.ll'
define double @foo(double, double) {
top:
%2 = fcmp une double %0, %1
br i1 %2, label %L3, label %L1
L1: ; preds = %top
%3 = fcmp une double %0, 0.000000e+00
br i1 %3, label %L3, label %L2
L2: ; preds = %L1
ret double %0
L3: ; preds = %L1, %top
%4 = fadd double %1, 1.000000e+00
ret double %4
}</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>