<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 --- - [InstcombineCompares] generates incorrect code for double comparision"
href="http://llvm.org/bugs/show_bug.cgi?id=22727">22727</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[InstcombineCompares] generates incorrect code for double comparision
</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>shivarama.rao@amd.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>Created <span class=""><a href="attachment.cgi?id=13960" name="attach_13960" title="input file to reproduce the problem.">attachment 13960</a> <a href="attachment.cgi?id=13960&action=edit" title="input file to reproduce the problem.">[details]</a></span>
input file to reproduce the problem.
for the attached testcase with following IR:
%i = ptrtoint i64* %add.ptr to i64
%conv = uitofp i64 %i to double
%cmp = fcmp ogt double %conv, 0.000000e+00
br i1 %cmp, label %if.then, label %if.else
opt -O2 generates following output
%i = ptrtoint i64* %add.ptr to i64
%cmp = icmp eq i64 %i, 0
br i1 %cmp, label %if.else, label %if.then
In the input test we had fcmp ogt, which got transformed into icmp eq which
doesnt seem to be correct. In the test input we are checking add.ptr > 0.0
whereas in the transformed code it is checked if %add.ptr == 0
The issue presents in trunk and is result of following checkin
commit d883ca0ca713c329deed614fa389230c7266d0e4
Author: Matt Arsenault <<a href="mailto:Matthew.Arsenault@amd.com">Matthew.Arsenault@amd.com</a>>
Date: Tue Jan 6 15:50:59 2015 +0000
Convert fcmp with 0.0 from casted integers to icmp
This is already handled in general when it is known the
conversion can't lose bits with smaller integer types
casted into wider floating point types.</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>