Index: lib/Analysis/LoopInfo.cpp =================================================================== --- lib/Analysis/LoopInfo.cpp +++ lib/Analysis/LoopInfo.cpp @@ -512,11 +512,14 @@ /// For subloop blocks, simply update SubloopParents and return NULL. Loop *UnloopUpdater::getNearestLoop(BasicBlock *BB, Loop *BBLoop) { + assert(Unloop && "Unloop cannot be NULL"); + // Initially for blocks directly contained by Unloop, NearLoop == Unloop and // is considered uninitialized. Loop *NearLoop = BBLoop; Loop *Subloop = nullptr; + assert(Unloop && "does not contain any loop"); if (NearLoop != Unloop && Unloop->contains(NearLoop)) { Subloop = NearLoop; // Find the subloop ancestor that is directly contained within Unloop. @@ -545,6 +548,7 @@ assert((FoundIB || !DFS.hasPostorder(*I)) && "should have seen IB"); FoundIB = true; } + assert(Unloop && "does not contain any loop"); if (L != Unloop && Unloop->contains(L)) { // Successor is in a subloop. if (Subloop) Index: lib/Analysis/ScalarEvolution.cpp =================================================================== --- lib/Analysis/ScalarEvolution.cpp +++ lib/Analysis/ScalarEvolution.cpp @@ -5554,6 +5554,8 @@ if (NumExits == 1) return; + assert(ENT && "ExitNotTakenExtras array is NULL, cannot further compute exits"); + auto &Exits = ExitNotTaken.ExtraInfo->Exits; // Handle the rare case of multiple computable exits.