<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 by operating on same set of instructions in worklist"
   href="https://bugs.llvm.org/show_bug.cgi?id=38915">38915</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[InstCombine] Infinite loop by operating on same set of instructions in worklist
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>opt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anna@azul.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This test goes into infinite loop when run with InstCombine on llvm ToT:

opt -instcombine test.ll <-- hangs with rerunning IC over the same set of
instructions in the worklist.

test.ll:
define void @baz(i32 %arg) {
bb:
  switch i32 undef, label %bb4 [
    i32 0, label %bb2
    i32 1, label %bb3
    i32 2, label %bb1
  ]

bb1:                                              ; preds = %bb
  ret void

bb2:                                              ; preds = %bb
  unreachable

bb3:                                              ; preds = %bb
  ret void

bb4:                                              ; preds = %bb
  %tmp = sub i32 0, %arg
  %tmp5 = and i32 %tmp, 3
  %tmp6 = sub i32 0, %tmp5
  %tmp7 = sub i32 0, %tmp5
  %tmp8 = sub i32 -2, %tmp5
  %tmp9 = icmp sgt i32 %tmp6, -2147483647
  %tmp10 = select i1 %tmp9, i32 %tmp6, i32 -2147483647
  %tmp11 = mul i32 %tmp10, -1
  %tmp12 = icmp sgt i32 %tmp7, -2147483647
  %tmp13 = select i1 %tmp12, i32 %tmp7, i32 -2147483647
  %tmp14 = mul i32 %tmp13, -1
  %tmp15 = icmp sgt i32 %tmp11, %tmp14
  %tmp16 = select i1 %tmp15, i32 %tmp11, i32 %tmp14
  %tmp17 = sub i32 -1, %tmp16
  %tmp18 = icmp sgt i32 %tmp17, %tmp8
  %tmp19 = select i1 %tmp18, i32 %tmp17, i32 %tmp8
  %tmp20 = sub i32 -1, %tmp19
  %tmp21 = icmp sgt i32 %tmp20, 1
  %tmp22 = select i1 %tmp21, i32 %tmp20, i32 1
  %tmp23 = add i32 %tmp22, -1
  %tmp24 = add i32 %tmp5, -1
  %tmp25 = icmp sgt i32 %tmp24, %tmp23
  br i1 %tmp25, label %bb26, label %bb27

bb26:                                             ; preds = %bb4
  unreachable

bb27:                                             ; preds = %bb4
  unreachable
}</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>