Skip to content

Commit ddd5741

Browse files
[Transforms] Avoid repeated hash lookups (NFC) (#109244)
1 parent e73d453 commit ddd5741

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,9 +859,9 @@ bool SampleProfileLoaderBaseImpl<BT>::propagateThroughEdges(
859859
LLVM_DEBUG(dbgs() << "Set self-referential edge weight to: ";
860860
printEdgeWeight(dbgs(), SelfReferentialEdge));
861861
}
862-
if (UpdateBlockCount && !VisitedBlocks.count(EC) && TotalWeight > 0) {
862+
if (UpdateBlockCount && TotalWeight > 0 &&
863+
VisitedBlocks.insert(EC).second) {
863864
BlockWeights[EC] = TotalWeight;
864-
VisitedBlocks.insert(EC);
865865
Changed = true;
866866
}
867867
}

0 commit comments

Comments
 (0)