[llvm] [Transforms] Avoid repeated hash lookups (NFC) (PR #109244)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 18 23:20:44 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/109244
None
>From 96c3e1199ebc0b9f7c4d87518b208063f2f5c907 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 17 Sep 2024 00:25:25 -0700
Subject: [PATCH] [Transforms] Avoid repeated hash lookups (NFC)
---
.../llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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