[llvm-bugs] [Bug 45778] New: InstSimplify: fadd (nsz op), +0 incorrectly removed
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat May 2 04:08:15 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45778
Bug ID: 45778
Summary: InstSimplify: fadd (nsz op), +0 incorrectly removed
Product: libraries
Version: trunk
Hardware: All
OS: All
Status: NEW
Keywords: miscompilation
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: nunoplopes at sapo.pt
CC: llvm-bugs at lists.llvm.org, regehr at cs.utah.edu,
spatel+llvm at rotateright.com
Test: Transforms/InstSimplify/fast-math.ll
Summary: +0 + +0 == +0 and -0 + +0 == +0 in default rounding mode. Hence below
when %nsz is +/-0 the function returns +0 only, while the optimized function
returns +/-0.
define float @fold_fadd_cannot_be_neg0_nsz_src_x_0(float %a, float %b) {
%nsz = fmul nsz float %a, %b
%add = fadd float %nsz, 0.000000
ret float %add
}
=>
define float @fold_fadd_cannot_be_neg0_nsz_src_x_0(float %a, float %b) {
%nsz = fmul nsz float %a, %b
ret float %nsz
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
float %a = #x01e21080 (0.000000000000?)
float %b = #x00225d01 (0.000000000000?)
Source:
float %nsz = #x80000000 (-0.0)
float %add = #x00000000 (+0.0)
Target:
float %nsz = #x80000000 (-0.0)
Source value: #x00000000 (+0.0)
Target value: #x80000000 (-0.0)
https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=1ede71ade7988ad1&test=Transforms%2FInstSimplify%2Ffast-math.ll
--
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/20200502/74157161/attachment.html>
More information about the llvm-bugs
mailing list