Skip to content

Commit 15762ea

Browse files
[Hexagon] Avoid repeated hash lookups (NFC) (#130545)
1 parent b4caea8 commit 15762ea

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,8 +2022,9 @@ static bool isTargetConstant(const SDValue &V) {
20222022
}
20232023

20242024
unsigned HexagonDAGToDAGISel::getUsesInFunction(const Value *V) {
2025-
if (GAUsesInFunction.count(V))
2026-
return GAUsesInFunction[V];
2025+
auto [It, Inserted] = GAUsesInFunction.try_emplace(V);
2026+
if (!Inserted)
2027+
return It->second;
20272028

20282029
unsigned Result = 0;
20292030
const Function &CurF = CurDAG->getMachineFunction().getFunction();
@@ -2033,7 +2034,7 @@ unsigned HexagonDAGToDAGISel::getUsesInFunction(const Value *V) {
20332034
++Result;
20342035
}
20352036

2036-
GAUsesInFunction[V] = Result;
2037+
It->second = Result;
20372038

20382039
return Result;
20392040
}

0 commit comments

Comments
 (0)