[LLVMbugs] [Bug 22823] New: gvn incorrectly changing sign of floating point zero
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 6 08:24:34 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22823
Bug ID: 22823
Summary: gvn incorrectly changing sign of floating point zero
Product: libraries
Version: 3.6
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: simonbyrne at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150306/696aab72/attachment.html>
More information about the llvm-bugs
mailing list