================ @@ -43,7 +43,20 @@ const Environment *StmtToEnvMap::getEnvironment(const Stmt &S) const { if (!CFCtx.isBlockReachable(*BlockIt->getSecond())) return nullptr; const auto &State = BlockToState[BlockIt->getSecond()->getBlockID()]; - assert(State); + if (!(State)) { + LLVM_DEBUG({ + // State can be null when this block is unreachable from the block that + // called this method. + bool hasUnreachableEdgeFromPred = false; + for (auto B : BlockIt->getSecond()->preds()) + if (!B) { + hasUnreachableEdgeFromPred = true; + break; + } + assert(hasUnreachableEdgeFromPred); ---------------- kinu wrote:
This check can be done more thoroughly (maybe with some pre-processing) if we want, but can be a bit costly. We won't hit this very often though https://github.com/llvm/llvm-project/pull/65732 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits