[llvm] [Transforms] Avoid repeated hash lookups (NFC) (PR #131554)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 16 20:23:21 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/131554.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 60aa758917b0b..4b7902ff502d3 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1679,8 +1679,8 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
if (auto *PHI = dyn_cast<PHINode>(Usr)) {
// Note the order here, the Usr access might change the map, CurPtr is
// already in it though.
- bool IsFirstPHIUser = !OffsetInfoMap.count(PHI);
- auto &UsrOI = OffsetInfoMap[PHI];
+ auto [PhiIt, IsFirstPHIUser] = OffsetInfoMap.try_emplace(PHI);
+ auto &UsrOI = PhiIt->second;
auto &PtrOI = OffsetInfoMap[CurPtr];
// Check if the PHI operand has already an unknown offset as we can't
``````````
</details>
https://github.com/llvm/llvm-project/pull/131554
More information about the llvm-commits
mailing list