[llvm-bugs] [Bug 36379] 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

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 14 04:52:38 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=36379

            Bug ID: 36379
           Summary: 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
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: fedor.v.sergeev at gmail.com
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180214/cd58f51e/attachment.html>


More information about the llvm-bugs mailing list