[MachineBlockPlacment] Add an assert to ensure there is no order dependency on DenseM...
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 12 Apr 2017 13:26:31 +0000 (13:26 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 12 Apr 2017 13:26:31 +0000 (13:26 +0000)
llvm-svn: 300060

llvm/lib/CodeGen/MachineBlockPlacement.cpp

index 6c1381b..e23f90b 100644 (file)
@@ -1160,8 +1160,8 @@ void MachineBlockPlacement::precomputeTriangleChains() {
       TriangleChainMap.insert(std::make_pair(Chain.getKey(), std::move(Chain)));
     } else {
       auto InsertResult = TriangleChainMap.try_emplace(PDom, &BB, PDom);
-      assert (InsertResult.second && "Block seen twice.");
-      (void) InsertResult;
+      assert(InsertResult.second && "Block seen twice.");
+      (void)InsertResult;
     }
   }
 
@@ -1177,7 +1177,11 @@ void MachineBlockPlacement::precomputeTriangleChains() {
     for (MachineBasicBlock *src : reverse(Chain.Edges)) {
       DEBUG(dbgs() << "Marking edge: " << getBlockName(src) << "->" <<
             getBlockName(dst) << " as pre-computed based on triangles.\n");
-      ComputedEdges[src] = { dst, true };
+
+      auto InsertResult = ComputedEdges.insert({src, {dst, true}});
+      assert(InsertResult.second && "Block seen twice.");
+      (void)InsertResult;
+
       dst = src;
     }
   }