aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-09-29 08:50:37 -0700
committerGitHub <noreply@github.com>2024-09-29 08:50:37 -0700
commit8a9e9a89f0f5d58d1dacf3a7e626d8eb1c4ea485 (patch)
treedb570958fbf17388d7d10cb3dc1d8cf90469b293 /llvm/lib/Analysis/InlineCost.cpp
parent5c811ccc4d4fff8c6cbfeff69c43d03884e3a9c1 (diff)
downloadllvm-8a9e9a89f0f5d58d1dacf3a7e626d8eb1c4ea485.zip
llvm-8a9e9a89f0f5d58d1dacf3a7e626d8eb1c4ea485.tar.gz
llvm-8a9e9a89f0f5d58d1dacf3a7e626d8eb1c4ea485.tar.bz2
[Analysis] Avoid repeated hash lookups (NFC) (#110397)
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 4b65fa0..d2c329b 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -504,8 +504,9 @@ public:
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 @@ public:
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;
}