[llvm] 7fa0d05 - [AsmParser] Simplify code with std::map::operator[] (NFC) (#111480)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 07:30:38 PDT 2024
Author: Kazu Hirata
Date: 2024-10-08T07:30:33-07:00
New Revision: 7fa0d05a04056aac4365c69c4b515f613a43e454
URL: https://github.com/llvm/llvm-project/commit/7fa0d05a04056aac4365c69c4b515f613a43e454
DIFF: https://github.com/llvm/llvm-project/commit/7fa0d05a04056aac4365c69c4b515f613a43e454.diff
LOG: [AsmParser] Simplify code with std::map::operator[] (NFC) (#111480)
Added:
Modified:
llvm/lib/AsmParser/LLParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 6450d8b109063a..9f2ef2e6a9311e 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4000,11 +4000,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
if (!F) {
// Make a global variable as a placeholder for this reference.
GlobalValue *&FwdRef =
- ForwardRefBlockAddresses.insert(std::make_pair(
- std::move(Fn),
- std::map<ValID, GlobalValue *>()))
- .first->second.insert(std::make_pair(std::move(Label), nullptr))
- .first->second;
+ ForwardRefBlockAddresses[std::move(Fn)][std::move(Label)];
if (!FwdRef) {
unsigned FwdDeclAS;
if (ExpectedTy) {
@@ -4082,7 +4078,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
auto &FwdRefMap = (Fn.Kind == ValID::t_GlobalID)
? ForwardRefDSOLocalEquivalentIDs
: ForwardRefDSOLocalEquivalentNames;
- GlobalValue *&FwdRef = FwdRefMap.try_emplace(Fn, nullptr).first->second;
+ GlobalValue *&FwdRef = FwdRefMap[Fn];
if (!FwdRef) {
FwdRef = new GlobalVariable(*M, Type::getInt8Ty(Context), false,
GlobalValue::InternalLinkage, nullptr, "",
More information about the llvm-commits
mailing list