<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 - opt crashes with -enable-nontrivial-unswitch -passes=unswitch: Assertion `(L.contains(ChildN->getBlock()) || llvm::find(ExitBlocks, ChildN->getBlock()) != ExitBlocks.end()) && "Should never reach beyond the loop and exits when deleting!"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=36379">36379</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with -enable-nontrivial-unswitch -passes=unswitch: Assertion `(L.contains(ChildN->getBlock()) || llvm::find(ExitBlocks, ChildN->getBlock()) != ExitBlocks.end()) && "Should never reach beyond the loop and exits when deleting!"' failed
          </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>normal
          </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>fedor.v.sergeev@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Fails on a rather simple IR:

] cat bad-unswitch.ll
define void @test() {
  br label %check1
check1:
  br i1 true, label %check2, label %check1
check2:
  br i1 true, label %check3, label %zero
check3:
  br i1 true, label %check4, label %zero
check4:
  br i1 true, label %check3, label %check1
zero:
  ret void
}
] opt --enable-nontrivial-unswitch -passes=unswitch --disable-output
bad-unswitch.ll
opt: lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:1238: void
deleteDeadBlocksFromLoop(llvm::Loop&, llvm::BasicBlock*,
llvm::SmallVectorImpl<llvm::BasicBlock*>&, llvm::DominatorTree&,
llvm::LoopInfo&): Assertion `(L.contains(ChildN->getBlock()) ||
llvm::find(ExitBlocks, ChildN->getBlock()) != ExitBlocks.end()) && "Should
never reach beyond the loop and exits when deleting!"' failed.
]

Originally it was failing on a considerably more complicated testcase where
trivial unswitch failed to perform any unswitches and I had to enable
nontrivial one. Got this assert immediately, reduced down to the above bits.</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>