[llvm] [Coroutines] Avoid repeated hash lookups (NFC) (PR #126432)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 9 11:46:23 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-coroutines
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/126432.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+4-3)
``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index c56d1bf33efd877..4104e4e533e9d86 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -752,13 +752,14 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
dwarf::DW_ATE_unsigned_char)});
for (auto *V : FrameData.getAllDefs()) {
- if (!DIVarCache.contains(V))
+ auto It = DIVarCache.find(V);
+ if (It == DIVarCache.end())
continue;
auto Index = FrameData.getFieldIndex(V);
- NameCache.insert({Index, DIVarCache[V]->getName()});
- TyCache.insert({Index, DIVarCache[V]->getType()});
+ NameCache.insert({Index, It->second->getName()});
+ TyCache.insert({Index, It->second->getType()});
}
// Cache from index to (Align, Offset Pair)
``````````
</details>
https://github.com/llvm/llvm-project/pull/126432
More information about the llvm-commits
mailing list