Reapply: Use an abbrev to reduce size of VALUE_GUID records in ThinLTO summaries (#106165)
This retries #90692 which was reverted previously due to issues with lld-available being set, even if the copy of lld is not built from source. This does not change any code compared to #90692 to address the lld-available issue. The main change w.r.t, lld-available is xfailing tests in PR #99056 (until a longer term fix is available).
This commit is contained in:
1 parent
81cd7358a2
commit
fa4fbaefde
22 files changed
+145
-113
No files matched your search
@@ -4350,9 +4350,20 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv->Add(BitCodeAbbrevOp(bitc::FS_VALUE_GUID));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
// GUIDS often use up most of 64-bits, so encode as two Fixed 32.
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
|
||||
unsigned ValueGuidAbbrev = Stream.EmitAbbrev(std::move(Abbv));
|
||||
|
||||
for (const auto &GVI : valueIds()) {
|
||||
Stream.EmitRecord(bitc::FS_VALUE_GUID,
|
||||
ArrayRef<uint64_t>{GVI.second, GVI.first});
|
||||
ArrayRef<uint32_t>{GVI.second,
|
||||
static_cast<uint32_t>(GVI.first >> 32),
|
||||
static_cast<uint32_t>(GVI.first)},
|
||||
ValueGuidAbbrev);
|
||||
}
|
||||
|
||||
if (!Index->stackIds().empty()) {
|
||||
@@ -4366,7 +4377,7 @@ void ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
|
||||
}
|
||||
|
||||
// Abbrev for FS_PERMODULE_PROFILE.
|
||||
auto Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_PROFILE));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // flags
|
||||
@@ -4520,9 +4531,20 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
|
||||
// Write the index flags.
|
||||
Stream.EmitRecord(bitc::FS_FLAGS, ArrayRef<uint64_t>{Index.getFlags()});
|
||||
|
||||
auto Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv->Add(BitCodeAbbrevOp(bitc::FS_VALUE_GUID));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
|
||||
// GUIDS often use up most of 64-bits, so encode as two Fixed 32.
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
|
||||
unsigned ValueGuidAbbrev = Stream.EmitAbbrev(std::move(Abbv));
|
||||
|
||||
for (const auto &GVI : valueIds()) {
|
||||
Stream.EmitRecord(bitc::FS_VALUE_GUID,
|
||||
ArrayRef<uint64_t>{GVI.second, GVI.first});
|
||||
ArrayRef<uint32_t>{GVI.second,
|
||||
static_cast<uint32_t>(GVI.first >> 32),
|
||||
static_cast<uint32_t>(GVI.first)},
|
||||
ValueGuidAbbrev);
|
||||
}
|
||||
|
||||
// Write the stack ids used by this index, which will be a subset of those in
|
||||
@@ -4538,7 +4560,7 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
|
||||
}
|
||||
|
||||
// Abbrev for FS_COMBINED_PROFILE.
|
||||
auto Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv = std::make_shared<BitCodeAbbrev>();
|
||||
Abbv->Add(BitCodeAbbrevOp(bitc::FS_COMBINED_PROFILE));
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // valueid
|
||||
Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // modid
|
||||
|
||||
Reference in new issue
Block a user