[llvm-bugs] [Bug 45478] New: Incorrect translation of minnum with nnan flag

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 8 13:05:18 PDT 2020


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

            Bug ID: 45478
           Summary: Incorrect translation of minnum with nnan flag
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: liuz at cs.utah.edu
                CC: llvm-bugs at lists.llvm.org

As stated in LangRef, if either operand for llvm.minnum is a NaN, returns the
other non-NaN operand. If llvm.minnum is attached with nnan flag, when an
argument is a NaN, it produces a poison value.

See below the incorrect transformation. When input %x is NaN, the source
program returns 0.0, while the target program returns poison. Target is more
poisonous than source.


llvm/test/Transforms/InstCombine/minnum.ll

define float @minnum_f32_1_minnum_p0_val_nnan_ninf(float %x) {
; CHECK-LABEL: @minnum_f32_1_minnum_p0_val_nnan_ninf(
; CHECK-NEXT:    [[TMP1:%.*]] = call nnan ninf float @llvm.minnum.f32(float
[[X:%.*]], float 0.000000e+00)
; CHECK-NEXT:    ret float [[TMP1]]
;
  %y = call float @llvm.minnum.f32(float 0.0, float %x)
  %z = call nnan ninf float @llvm.minnum.f32(float %y, float 1.0)
  ret float %z
}

-- 
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/20200408/0f8a2443/attachment.html>


More information about the llvm-bugs mailing list