[llvm] 8789c00 - [Transforms] Avoid repeated hash lookups (NFC) (#131554)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 17 07:42:25 PDT 2025
Author: Kazu Hirata
Date: 2025-03-17T07:42:21-07:00
New Revision: 8789c0083de178fd044e5fb94b3a36c2eec49e0a
URL: https://github.com/llvm/llvm-project/commit/8789c0083de178fd044e5fb94b3a36c2eec49e0a
DIFF: https://github.com/llvm/llvm-project/commit/8789c0083de178fd044e5fb94b3a36c2eec49e0a.diff
LOG: [Transforms] Avoid repeated hash lookups (NFC) (#131554)
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
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
More information about the llvm-commits
mailing list