[llvm] 15762ea - [Hexagon] Avoid repeated hash lookups (NFC) (#130545)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 10 10:17:44 PDT 2025
Author: Kazu Hirata
Date: 2025-03-10T10:17:41-07:00
New Revision: 15762ea2fa687910609fd55cc3eca82c3a04b271
URL: https://github.com/llvm/llvm-project/commit/15762ea2fa687910609fd55cc3eca82c3a04b271
DIFF: https://github.com/llvm/llvm-project/commit/15762ea2fa687910609fd55cc3eca82c3a04b271.diff
LOG: [Hexagon] Avoid repeated hash lookups (NFC) (#130545)
Added:
Modified:
llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
index c0baf301e0624..4bb1b1eb22eba 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
@@ -2022,8 +2022,9 @@ static bool isTargetConstant(const SDValue &V) {
}
unsigned HexagonDAGToDAGISel::getUsesInFunction(const Value *V) {
- if (GAUsesInFunction.count(V))
- return GAUsesInFunction[V];
+ auto [It, Inserted] = GAUsesInFunction.try_emplace(V);
+ if (!Inserted)
+ return It->second;
unsigned Result = 0;
const Function &CurF = CurDAG->getMachineFunction().getFunction();
@@ -2033,7 +2034,7 @@ unsigned HexagonDAGToDAGISel::getUsesInFunction(const Value *V) {
++Result;
}
- GAUsesInFunction[V] = Result;
+ It->second = Result;
return Result;
}
More information about the llvm-commits
mailing list