-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[GVNSink] Avoid repeated hash lookups (NFC) #113023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GVNSink] Avoid repeated hash lookups (NFC) #113023
Conversation
|
@llvm/pr-subscribers-llvm-transforms Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/113023.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 3dfa2dd9df27f5..42b44725240f29 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -535,12 +535,12 @@ class ValueTable {
uint32_t e = ExpressionNumbering[exp];
if (!e) {
hash_code H = exp->getHashValue([=](Value *V) { return lookupOrAdd(V); });
- auto I = HashNumbering.find(H);
- if (I != HashNumbering.end()) {
+ auto [I, Inserted] = HashNumbering.try_emplace(H);
+ if (!Inserted) {
e = I->second;
} else {
e = nextValueNumber++;
- HashNumbering[H] = e;
+ I->second = e;
ExpressionNumbering[exp] = e;
}
}
|
2a5b09c to
01377c7
Compare
|
Please take a look. Thanks! |
nikic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
7bdb90e to
a8181bc
Compare
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/12373 Here is the relevant piece of the build log for the reference |
No description provided.