Remove assert(false) in favor of asserting the if conditional it is contained within.
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 26 Oct 2015 18:41:13 +0000 (18:41 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 26 Oct 2015 18:41:13 +0000 (18:41 +0000)
Also adjust the code to avoid 3 redundant map lookups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251327 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Analysis.cpp

index a13ab0d8b8def1c85bad1ae35ac4dd4e4097b406..75579a2b45595c6174d985e8dd2faa5578a98f56 100644 (file)
@@ -649,18 +649,15 @@ bool llvm::canBeOmittedFromSymbolTable(const GlobalValue *GV) {
 static void collectFuncletMembers(
     DenseMap<const MachineBasicBlock *, int> &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()) {