<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 with select / icmp"
   href="https://bugs.llvm.org/show_bug.cgi?id=48900">48900</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] Infinite loop with select / icmp
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>enhancement
          </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>florian_hahn@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Running `opt -instcombine` on the function below triggers an infinite loop in
instcombine and it looks like it does not get caught by the existing checks.


define i32 @clamp_check_for_no_infinite_loop3(i32 %i) {
  %i2 = icmp ugt i32 %i, 1
  %i3 = select i1 %i2, i32 %i, i32 1
  %i4 = icmp sgt i32 %i3, 0
  br i1 %i4, label %truelabel, label %falselabel

truelabel:                                        ; preds = %0
  %i5 = icmp slt i32 %i3, 2
  %i6 = select i1 %i5, i32 %i3, i32 2
  %i7 = shl nuw nsw i32 %i6, 2
  ret i32 %i7

falselabel:                                       ; preds = %0
  ret i32 0
}



This is a reduced version of
<a href="https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29957">https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29957</a></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>