@@ -121,9 +121,6 @@ void llvm::computeLTOCacheKey(
121
121
support::endian::write64le (Data, I);
122
122
Hasher.update (Data);
123
123
};
124
- auto AddUint8 = [&](const uint8_t I) {
125
- Hasher.update (ArrayRef<uint8_t >((const uint8_t *)&I, 1 ));
126
- };
127
124
AddString (Conf.CPU );
128
125
// FIXME: Hash more of Options. For now all clients initialize Options from
129
126
// command-line flags (which is unsupported in production), but may set
@@ -159,18 +156,18 @@ void llvm::computeLTOCacheKey(
159
156
auto ModHash = Index.getModuleHash (ModuleID);
160
157
Hasher.update (ArrayRef<uint8_t >((uint8_t *)&ModHash[0 ], sizeof (ModHash)));
161
158
162
- std::vector<std::pair< uint64_t , uint8_t > > ExportsGUID;
159
+ std::vector<uint64_t > ExportsGUID;
163
160
ExportsGUID.reserve (ExportList.size ());
164
- for (const auto &[VI, ExportType] : ExportList)
165
- ExportsGUID.push_back (
166
- std::make_pair (VI.getGUID (), static_cast <uint8_t >(ExportType)));
161
+ for (const auto &VI : ExportList) {
162
+ auto GUID = VI.getGUID ();
163
+ ExportsGUID.push_back (GUID);
164
+ }
167
165
168
166
// Sort the export list elements GUIDs.
169
167
llvm::sort (ExportsGUID);
170
- for (auto [ GUID, ExportType] : ExportsGUID) {
168
+ for (uint64_t GUID : ExportsGUID) {
171
169
// The export list can impact the internalization, be conservative here
172
170
Hasher.update (ArrayRef<uint8_t >((uint8_t *)&GUID, sizeof (GUID)));
173
- AddUint8 (ExportType);
174
171
}
175
172
176
173
// Include the hash for every module we import functions from. The set of
@@ -202,21 +199,19 @@ void llvm::computeLTOCacheKey(
202
199
[](const ImportModule &Lhs, const ImportModule &Rhs) -> bool {
203
200
return Lhs.getHash () < Rhs.getHash ();
204
201
});
205
- std::vector<std::pair< uint64_t , uint8_t > > ImportedGUIDs;
202
+ std::vector<uint64_t > ImportedGUIDs;
206
203
for (const ImportModule &Entry : ImportModulesVector) {
207
204
auto ModHash = Entry.getHash ();
208
205
Hasher.update (ArrayRef<uint8_t >((uint8_t *)&ModHash[0 ], sizeof (ModHash)));
209
206
210
207
AddUint64 (Entry.getFunctions ().size ());
211
208
212
209
ImportedGUIDs.clear ();
213
- for (auto &[Fn, ImportType] : Entry.getFunctions ())
214
- ImportedGUIDs.push_back (std::make_pair (Fn, ImportType) );
210
+ for (auto &Fn : Entry.getFunctions ())
211
+ ImportedGUIDs.push_back (Fn );
215
212
llvm::sort (ImportedGUIDs);
216
- for (auto &[ GUID, Type] : ImportedGUIDs) {
213
+ for (auto &GUID : ImportedGUIDs)
217
214
AddUint64 (GUID);
218
- AddUint8 (Type);
219
- }
220
215
}
221
216
222
217
// Include the hash for the resolved ODR.
@@ -286,9 +281,9 @@ void llvm::computeLTOCacheKey(
286
281
// Imported functions may introduce new uses of type identifier resolutions,
287
282
// so we need to collect their used resolutions as well.
288
283
for (const ImportModule &ImpM : ImportModulesVector)
289
- for (auto &[GUID, UnusedImportType] : ImpM.getFunctions ()) {
284
+ for (auto &ImpF : ImpM.getFunctions ()) {
290
285
GlobalValueSummary *S =
291
- Index.findSummaryInModule (GUID , ImpM.getIdentifier ());
286
+ Index.findSummaryInModule (ImpF , ImpM.getIdentifier ());
292
287
AddUsedThings (S);
293
288
// If this is an alias, we also care about any types/etc. that the aliasee
294
289
// may reference.
@@ -1400,7 +1395,6 @@ class lto::ThinBackendProc {
1400
1395
llvm::StringRef ModulePath,
1401
1396
const std::string &NewModulePath) {
1402
1397
std::map<std::string, GVSummaryMapTy> ModuleToSummariesForIndex;
1403
-
1404
1398
std::error_code EC;
1405
1399
gatherImportedSummariesForModule (ModulePath, ModuleToDefinedGVSummaries,
1406
1400
ImportList, ModuleToSummariesForIndex);
@@ -1409,8 +1403,6 @@ class lto::ThinBackendProc {
1409
1403
sys::fs::OpenFlags::OF_None);
1410
1404
if (EC)
1411
1405
return errorCodeToError (EC);
1412
-
1413
- // TODO: Serialize declaration bits to bitcode.
1414
1406
writeIndexToFile (CombinedIndex, OS, &ModuleToSummariesForIndex);
1415
1407
1416
1408
if (ShouldEmitImportsFiles) {
0 commit comments