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; }