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

            Bug ID: 49654
           Summary: [InstCombine] Incorrect propagation of nsz from fneg
                    to fdiv
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: nunoplo...@sapo.pt
                CC: cameron.mcina...@nyu.edu, juneyoung....@sf.snu.ac.kr,
                    llvm-bugs@lists.llvm.org, spatel+l...@rotateright.com

This is from Transforms/InstCombine/fneg.ll, reduced from fast to just nsz.
The issue is that the original fdiv has no nsz but the optimized one has. In
this case, nsz can be propagated, but not added (even if fneg is nsz).


define float @fdiv_op0_constant_fneg_fmf(float %x) {
  %d = fdiv float 42.000000, %x
  %r = fneg nsz float %d
  ret float %r
}
=>
define float @fdiv_op0_constant_fneg_fmf(float %x) {
  %r = fdiv nsz float -42.000000, %x
  ret float %r
}
Transformation doesn't verify!
ERROR: Value mismatch

Example:
float %x = #x80000000 (-0.0)

Source:
float %d = #xff800000 (-oo)
float %r = #x7f800000 (+oo)

Target:
float %r = #xff800000 (-oo)
Source value: #x7f800000 (+oo)
Target value: #xff800000 (-oo)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to