mirror of
https://github.com/RPCSX/llvm.git
synced 2026-01-31 01:05:23 +01:00
[ThinLTO] Avoid unnecesary hash lookups during metadata linking (NFC)
Replace sequences of count() followed by operator[] with either find() or insert(), depending on the context. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3081,9 +3081,11 @@ void BitcodeReader::saveMetadataList(
|
||||
if (!OnlyTempMD || (N && N->isTemporary())) {
|
||||
// Will call this after materializing each function, in order to
|
||||
// handle remapping of the function's instructions/metadata.
|
||||
auto IterBool = MetadataToIDs.insert(std::make_pair(MD, ID));
|
||||
// See if we already have an entry in that case.
|
||||
if (OnlyTempMD && MetadataToIDs.count(MD)) {
|
||||
assert(MetadataToIDs[MD] == ID && "Inconsistent metadata value id");
|
||||
if (OnlyTempMD && !IterBool.second) {
|
||||
assert(IterBool.first->second == ID &&
|
||||
"Inconsistent metadata value id");
|
||||
continue;
|
||||
}
|
||||
if (N && N->isTemporary())
|
||||
@@ -3091,7 +3093,6 @@ void BitcodeReader::saveMetadataList(
|
||||
// metadata while it is the key of a map. The flag will be set back
|
||||
// to true when the saved metadata list is destroyed.
|
||||
N->setCanReplace(false);
|
||||
MetadataToIDs[MD] = ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user