Skip to content

Commit 7fa0d05

Browse files
[AsmParser] Simplify code with std::map::operator[] (NFC) (#111480)
1 parent d48920d commit 7fa0d05

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4000,11 +4000,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
40004000
if (!F) {
40014001
// Make a global variable as a placeholder for this reference.
40024002
GlobalValue *&FwdRef =
4003-
ForwardRefBlockAddresses.insert(std::make_pair(
4004-
std::move(Fn),
4005-
std::map<ValID, GlobalValue *>()))
4006-
.first->second.insert(std::make_pair(std::move(Label), nullptr))
4007-
.first->second;
4003+
ForwardRefBlockAddresses[std::move(Fn)][std::move(Label)];
40084004
if (!FwdRef) {
40094005
unsigned FwdDeclAS;
40104006
if (ExpectedTy) {
@@ -4082,7 +4078,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
40824078
auto &FwdRefMap = (Fn.Kind == ValID::t_GlobalID)
40834079
? ForwardRefDSOLocalEquivalentIDs
40844080
: ForwardRefDSOLocalEquivalentNames;
4085-
GlobalValue *&FwdRef = FwdRefMap.try_emplace(Fn, nullptr).first->second;
4081+
GlobalValue *&FwdRef = FwdRefMap[Fn];
40864082
if (!FwdRef) {
40874083
FwdRef = new GlobalVariable(*M, Type::getInt8Ty(Context), false,
40884084
GlobalValue::InternalLinkage, nullptr, "",

0 commit comments

Comments
 (0)