diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp index 4c59278eaaa01..dc1dd5d9c7f4c 100644 --- a/llvm/lib/Passes/StandardInstrumentations.cpp +++ b/llvm/lib/Passes/StandardInstrumentations.cpp @@ -2001,14 +2001,12 @@ DotCfgDiff::DotCfgDiff(StringRef Title, const FuncDataT &Before, for (auto &A : After.getData()) { StringRef Label = A.getKey(); const BlockDataT &BD = A.getValue(); - unsigned C = NodePosition.count(Label); - if (C == 0) + auto It = NodePosition.find(Label); + if (It == NodePosition.end()) // This only exists in the after IR. Create the node. createNode(Label, BD, AfterColour); - else { - assert(C == 1 && "Unexpected multiple nodes."); - Nodes[NodePosition[Label]].setCommon(BD); - } + else + Nodes[It->second].setCommon(BD); // Add in the edges between the nodes (as common or only in after). for (StringMap::const_iterator Sink = BD.getData().begin(), E = BD.getData().end();