[llvm-bugs] [Bug 47960] New: Incorrect transformation of fabs with nnan flag

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 23 18:27:41 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47960

            Bug ID: 47960
           Summary: Incorrect transformation of fabs with nnan flag
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: juneyoung.lee at sf.snu.ac.kr
                CC: llvm-bugs at lists.llvm.org

// llvm/test/Transforms/InstCombine/fabs.ll

```
define double @select_fcmp_nnan_ole_zero(double %x) {
%0:
  %lezero = fcmp ole double %x, 0.000000
  %negx = fsub nnan double 0.000000, %x
  %fabs = select i1 %lezero, double %negx, double %x
  ret double %fabs
}
=>
define double @select_fcmp_nnan_ole_zero(double %x) {
%0:
  %1 = fabs nnan double %x
  ret double %1
}
Transformation doesn't verify!
ERROR: Target is more poisonous than source

Example:
double %x = NaN

Source:
i1 %lezero = #x0 (0)
double %negx = poison
double %fabs = NaN

Target:
double %1 = poison
Source value: NaN
Target value: poison
```

After the transformation, nnan flag should be dropped because %x can be NaN.

-- 
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/20201024/e6790448/attachment-0001.html>


More information about the llvm-bugs mailing list