<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 - [InstCombine] Infinite loop in InstCombine on smax+cmp+select sequence"
   href="https://bugs.llvm.org/show_bug.cgi?id=51419">51419</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] Infinite loop in InstCombine on smax+cmp+select sequence
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>cameron.mcinally@nyu.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following test case is tripping an infinite loop in InstCombine. I've been
unable to track down the root cause yet.

This issue was found in release/13.x, but Godbolt shows it failing in trunk as
well.

<a href="https://godbolt.org/z/xKasbGheK">https://godbolt.org/z/xKasbGheK</a>

; RUN: opt -O3 -instcombine -S < %s
define i64 @infloop(double %d, i64 %a) {
  %1 = fptosi double %d to i32
  %2 = call i32 @llvm.smax.i32(i32 %1, i32 0)
  %3 = icmp slt i32 %2, 2
  %4 = zext i1 %3 to i32
  %5 = select i1 %3, i32 %2, i32 1
  %6 = zext i32 %5 to i64
  %7 = mul i64 %6, 4
  %8 = add i64 %a, %7
  ret i64 %8
}</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>