-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Analysis] Avoid repeated hash lookups (NFC) #110397
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
[Analysis] Avoid repeated hash lookups (NFC) #110397
Conversation
@llvm/pr-subscribers-llvm-analysis Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/110397.diff 1 Files Affected:
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 4b65fa0ae41b2f..d2c329ba748e58 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -504,8 +504,9 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
InlineResult analyze();
std::optional<Constant *> getSimplifiedValue(Instruction *I) {
- if (SimplifiedValues.contains(I))
- return SimplifiedValues[I];
+ auto It = SimplifiedValues.find(I);
+ if (It != SimplifiedValues.end())
+ return It->second;
return std::nullopt;
}
@@ -1129,8 +1130,9 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
void print(raw_ostream &OS);
std::optional<InstructionCostDetail> getCostDetails(const Instruction *I) {
- if (InstructionCostDetailMap.contains(I))
- return InstructionCostDetailMap[I];
+ auto It = InstructionCostDetailMap.find(I);
+ if (It != InstructionCostDetailMap.end())
+ return It->second;
return std::nullopt;
}
|
c1974c5
to
5065e28
Compare
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
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/6612 Here is the relevant piece of the build log for the reference
|
No description provided.