Skip to content

Commit 3456c50

Browse files
clang-format; and use the lexicographic comparison of std::pair
1 parent dd35621 commit 3456c50

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

llvm/lib/LTO/LTO.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@ void llvm::computeLTOCacheKey(
166166
std::make_pair(VI.getGUID(), static_cast<uint8_t>(ExportType)));
167167

168168
// Sort the export list elements GUIDs.
169-
llvm::sort(ExportsGUID, [](const std::pair<uint64_t, uint8_t> &LHS,
170-
const std::pair<uint64_t, uint8_t> &RHS) {
171-
if (LHS.first != RHS.first)
172-
return LHS.first < RHS.first;
173-
return LHS.second < RHS.second;
174-
});
169+
llvm::sort(ExportsGUID);
175170
for (auto [GUID, ExportType] : ExportsGUID) {
176171
// The export list can impact the internalization, be conservative here
177172
Hasher.update(ArrayRef<uint8_t>((uint8_t *)&GUID, sizeof(GUID)));
@@ -218,7 +213,7 @@ void llvm::computeLTOCacheKey(
218213
for (auto &[Fn, ImportType] : Entry.getFunctions())
219214
ImportedGUIDs.push_back(std::make_pair(Fn, ImportType));
220215
llvm::sort(ImportedGUIDs);
221-
for (auto &[GUID, Type]: ImportedGUIDs) {
216+
for (auto &[GUID, Type] : ImportedGUIDs) {
222217
AddUint64(GUID);
223218
AddUint8(Type);
224219
}

llvm/lib/Transforms/IPO/FunctionImport.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,8 @@ class GlobalsImporter final {
390390
// Only update stat and exports if we haven't already imported this
391391
// variable.
392392
if (!Inserted) {
393-
// FIXME: Introduce a wrapper struct around ImportType, and provide
394-
// an `updateType` method for better readability, just like how we
395-
// update the hotness of a call edge.
393+
// Set the value to 'std::min(existing-value, new-value)' to make
394+
// sure a definition takes precedence over a declaration.
396395
Iter->second = std::min(GlobalValueSummary::Definition, Iter->second);
397396
break;
398397
}

0 commit comments

Comments
 (0)