[llvm] [Coroutines] Avoid repeated hash lookups (NFC) (PR #111617)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 19:21:15 PDT 2024
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/111617.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 91530503a7e1ed..2b43b7a5d027d1 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -797,8 +797,8 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
AlignInBits = OffsetCache[Index].first * 8;
OffsetInBits = OffsetCache[Index].second * 8;
- if (NameCache.contains(Index)) {
- Name = NameCache[Index].str();
+ if (auto It = NameCache.find(Index); It != NameCache.end()) {
+ Name = It->second.str();
DITy = TyCache[Index];
} else {
DITy = solveDIType(DBuilder, Ty, Layout, FrameDITy, LineNum, DITypeCache);
``````````
</details>
https://github.com/llvm/llvm-project/pull/111617
More information about the llvm-commits
mailing list