Skip to content

Commit fe51b4b

Browse files
author
git apple-llvm automerger
committed
Merge commit '577585198637' from llvm.org/main into next
2 parents 0d6ff05 + 5775851 commit fe51b4b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

llvm/include/llvm/ADT/EquivalenceClasses.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ template <class ElemTy> class EquivalenceClasses {
218218
/// insert - Insert a new value into the union/find set, ignoring the request
219219
/// if the value already exists.
220220
const ECValue &insert(const ElemTy &Data) {
221-
auto I = TheMapping.insert({Data, nullptr});
222-
if (!I.second)
223-
return *I.first->second;
221+
auto [I, Inserted] = TheMapping.try_emplace(Data);
222+
if (!Inserted)
223+
return *I->second;
224224

225225
auto *ECV = new (ECValueAllocator) ECValue(Data);
226-
I.first->second = ECV;
226+
I->second = ECV;
227227
Members.push_back(ECV);
228228
return *ECV;
229229
}

llvm/lib/MC/MCContext.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,8 @@ MCSectionGOFF *MCContext::getGOFFSection(SectionKind Kind, StringRef Name,
734734
UniqueName.append("/").append(P->getName());
735735
}
736736
// Do the lookup. If we don't have a hit, return a new section.
737-
auto IterBool = GOFFUniquingMap.insert(std::make_pair(UniqueName, nullptr));
738-
auto Iter = IterBool.first;
739-
if (!IterBool.second)
737+
auto [Iter, Inserted] = GOFFUniquingMap.try_emplace(UniqueName);
738+
if (!Inserted)
740739
return Iter->second;
741740

742741
StringRef CachedName = StringRef(Iter->first.c_str(), Name.size());

0 commit comments

Comments
 (0)