Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AsmParser] Simplify code with std::map::operator[] (NFC) #111480

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions llvm/lib/AsmParser/LLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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, "",
Expand Down
Loading