Skip to content

Commit d1d5f00

Browse files
[Passes] Avoid repeated hash lookups (NFC) (#135542)
1 parent 4b4cd64 commit d1d5f00

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,14 +2001,12 @@ DotCfgDiff::DotCfgDiff(StringRef Title, const FuncDataT<DCData> &Before,
20012001
for (auto &A : After.getData()) {
20022002
StringRef Label = A.getKey();
20032003
const BlockDataT<DCData> &BD = A.getValue();
2004-
unsigned C = NodePosition.count(Label);
2005-
if (C == 0)
2004+
auto It = NodePosition.find(Label);
2005+
if (It == NodePosition.end())
20062006
// This only exists in the after IR. Create the node.
20072007
createNode(Label, BD, AfterColour);
2008-
else {
2009-
assert(C == 1 && "Unexpected multiple nodes.");
2010-
Nodes[NodePosition[Label]].setCommon(BD);
2011-
}
2008+
else
2009+
Nodes[It->second].setCommon(BD);
20122010
// Add in the edges between the nodes (as common or only in after).
20132011
for (StringMap<std::string>::const_iterator Sink = BD.getData().begin(),
20142012
E = BD.getData().end();

0 commit comments

Comments
 (0)