diff --git a/lib/CodeGen/Analysis.cpp b/lib/CodeGen/Analysis.cpp index a13ab0d8b8d..75579a2b455 100644 --- a/lib/CodeGen/Analysis.cpp +++ b/lib/CodeGen/Analysis.cpp @@ -649,18 +649,15 @@ bool llvm::canBeOmittedFromSymbolTable(const GlobalValue *GV) { static void collectFuncletMembers( DenseMap &FuncletMembership, int Funclet, const MachineBasicBlock *MBB) { + // Add this MBB to our funclet. + auto P = FuncletMembership.insert(std::make_pair(MBB, Funclet)); + // Don't revisit blocks. - if (FuncletMembership.count(MBB) > 0) { - if (FuncletMembership[MBB] != Funclet) { - assert(false && "MBB is part of two funclets!"); - report_fatal_error("MBB is part of two funclets!"); - } + if (!P.second) { + assert(P.first->second == Funclet && "MBB is part of two funclets!"); return; } - // Add this MBB to our funclet. - FuncletMembership[MBB] = Funclet; - bool IsReturn = false; int NumTerminators = 0; for (const MachineInstr &MI : MBB->terminators()) {