<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 - SimpleLoopUnswitch incorrectly leaves make.implicit MD when there's an infinite loop"
   href="https://bugs.llvm.org/show_bug.cgi?id=47513">47513</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SimpleLoopUnswitch incorrectly leaves make.implicit MD when there's an infinite loop
          </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>Linux
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>suc-daniil@yandex.ru
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Here's a test case:
cmd: opt -enable-nontrivial-unswitch=true
-passes='loop(unswitch),verify<loops>' -S < %s

define i32 @test_should_drop_make_implicit.infinite_loop(i32* %p1, i32* %p2,
i1* %p3) {
entry:
  %null_check = icmp eq i32* %p2, null
  br label %loop.header
loop.header:
  %iv = phi i32 [0, %entry], [%iv.next, %backedge]
  br label %possibly_infinite_loop
possibly_infinite_loop:
  %inner_loop.cond = load i1, i1* %p3
  br i1 %inner_loop.cond, label %possibly_infinite_loop, label %loop.body
loop.body:
  %x = load i32, i32* %p1
  %side_exit_cond = icmp eq i32 %x, 0
  br i1 %null_check, label %throw_npe, label %backedge, !make.implicit !0
backedge:
  %iv.next = add i32 %iv,1
  %loop_cond = icmp slt i32 %iv.next, 10000
  br i1 %loop_cond, label %loop.header, label %exit
throw_npe:
  call void @throw_npe()
  unreachable
exit:
  ret i32 %x
}

Due to a possibly infinite loop between the outer loop entry and the null
check, make.implicit MD should be dropped when we unswitch the loop on
%null_check condition. However, currently we keep that MD.</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>