Currently isLoopExiting returns true for BBs that are not part of the
loop. To avoid hiding subtle bugs, this patch adds an assertion to make
sure the passed BB is inside the loop
Reviewers: reames, efriedma, hfinkel, arsenm, nhaehnle
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D63952
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365077
91177308-0d34-0410-b5e6-
96231b3b80d8
}
/// True if terminator in the block can branch to another block that is
- /// outside of the current loop.
+ /// outside of the current loop. \p BB must be inside the loop.
bool isLoopExiting(const BlockT *BB) const {
assert(!isInvalid() && "Loop not in a valid state!");
+ assert(contains(BB) && "Exiting block must be part of the loop");
for (const auto &Succ : children<const BlockT *>(BB)) {
if (!contains(Succ))
return true;