[llvm] ddd5741 - [Transforms] Avoid repeated hash lookups (NFC) (#109244)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 09:16:00 PDT 2024
Author: Kazu Hirata
Date: 2024-09-19T09:15:57-07:00
New Revision: ddd5741521ed50468f06adcacc8ea41256356224
URL: https://github.com/llvm/llvm-project/commit/ddd5741521ed50468f06adcacc8ea41256356224
DIFF: https://github.com/llvm/llvm-project/commit/ddd5741521ed50468f06adcacc8ea41256356224.diff
LOG: [Transforms] Avoid repeated hash lookups (NFC) (#109244)
Added:
Modified:
llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
index 5132dca7c6a22b..d86630decd3aea 100644
--- a/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
+++ b/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h
@@ -859,9 +859,9 @@ bool SampleProfileLoaderBaseImpl<BT>::propagateThroughEdges(
LLVM_DEBUG(dbgs() << "Set self-referential edge weight to: ";
printEdgeWeight(dbgs(), SelfReferentialEdge));
}
- if (UpdateBlockCount && !VisitedBlocks.count(EC) && TotalWeight > 0) {
+ if (UpdateBlockCount && TotalWeight > 0 &&
+ VisitedBlocks.insert(EC).second) {
BlockWeights[EC] = TotalWeight;
- VisitedBlocks.insert(EC);
Changed = true;
}
}
More information about the llvm-commits
mailing list