<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Incorrect translation of minnum with nnan flag"
   href="https://bugs.llvm.org/show_bug.cgi?id=45478">45478</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect translation of minnum with nnan flag
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>liuz@cs.utah.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>