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: unassignedb...@nondot.org
          Reporter: fedor.v.serg...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to