Bug 1845175 - Undo bug 1811960. r=firefox-build-system-reviewers,ahochheiden

Now that we have upgraded to a version of rustc that uses LLVM 16, it
can read profile data from LLVM 16, so we don't need to artificially
make the profile data look like LLVM 15's anymore.

Differential Revision: https://phabricator.services.mozilla.com/D184413
This commit is contained in:
Mike Hommey 2023-07-25 04:50:45 +00:00
parent 191fd2e1b8
commit 47ee59e2d4
4 changed files with 0 additions and 214 deletions

View file

@ -6,7 +6,6 @@
"downgrade-mangling-error_clang_12.patch",
"fuzzing_ccov_build_clang_12.patch",
"partial-revert-llvmorg-16-init-17151-gaa0883b59ae1.patch",
"partial-revert-llvmorg-16-init-15775-g1ae7d83803e4.patch",
"revert-llvmorg-16-init-11301-g163bb6d64e5f.patch",
"revert-llvmorg-16-init-7598-g54bfd0484615.patch",
"revert-llvmorg-15-init-13446-g7524fe962e47.patch",

View file

@ -9,7 +9,6 @@
"partial-revert-llvmorg-17-init-7686-g244be0b0de19.patch",
"revert-llvmorg-17-init-4120-g02e8eb1a438b.patch",
"partial-revert-llvmorg-16-init-17151-gaa0883b59ae1_clang_17.patch",
"partial-revert-llvmorg-16-init-15775-g1ae7d83803e4_clang_17.patch",
"revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_17.patch",
"revert-llvmorg-16-init-7598-g54bfd0484615.patch",
"revert-llvmorg-15-init-13446-g7524fe962e47.patch",

View file

@ -1,106 +0,0 @@
The change in https://github.com/llvm/llvm-project/commit/1ae7d83803e45f6053ec6a606f259653846926b8
makes rustc unable to read the profiles that `llvm-profdata merge` outputs,
further causing some problems (e.g. bug 1811960).
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index af3c27ebac76..a6da1e0f3aec 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -291,10 +291,6 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
for (auto &Func : I.getValue())
addRecord(I.getKey(), Func.first, std::move(Func.second), 1, Warn);
- BinaryIds.reserve(BinaryIds.size() + IPW.BinaryIds.size());
- for (auto &I : IPW.BinaryIds)
- addBinaryIds(I);
-
MemProfFrameData.reserve(IPW.MemProfFrameData.size());
for (auto &I : IPW.MemProfFrameData) {
// If we weren't able to add the frame mappings then it doesn't make sense
@@ -339,7 +335,6 @@ static void setSummary(IndexedInstrProf::Summary *TheSummary,
Error InstrProfWriter::writeImpl(ProfOStream &OS) {
using namespace IndexedInstrProf;
- using namespace support;
OnDiskChainedHashTableGenerator<InstrProfRecordWriterTrait> Generator;
@@ -356,7 +351,7 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
// Write the header.
IndexedInstrProf::Header Header;
Header.Magic = IndexedInstrProf::Magic;
- Header.Version = IndexedInstrProf::ProfVersion::CurrentVersion;
+ Header.Version = IndexedInstrProf::ProfVersion::Version8;
if (static_cast<bool>(ProfileKind & InstrProfKind::IRInstrumentation))
Header.Version |= VARIANT_MASK_IR_PROF;
if (static_cast<bool>(ProfileKind & InstrProfKind::ContextSensitive))
@@ -396,12 +389,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
// profile contains memory profile information.
OS.write(0);
- // Save the location of binary ids section.
- uint64_t BinaryIdSectionOffset = OS.tell();
- // Reserve space for the BinaryIdOffset field to be patched later if this
- // profile contains binary ids.
- OS.write(0);
-
// Reserve space to write profile summary data.
uint32_t NumEntries = ProfileSummaryBuilder::DefaultCutoffs.size();
uint32_t SummarySize = Summary::getSize(Summary::NumKinds, NumEntries);
@@ -478,43 +465,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
OS.patch(PatchItems, 3);
}
- // BinaryIdSection has two parts:
- // 1. uint64_t BinaryIdsSectionSize
- // 2. list of binary ids that consist of:
- // a. uint64_t BinaryIdLength
- // b. uint8_t BinaryIdData
- // c. uint8_t Padding (if necessary)
- uint64_t BinaryIdSectionStart = OS.tell();
- // Calculate size of binary section.
- uint64_t BinaryIdsSectionSize = 0;
-
- // Remove duplicate binary ids.
- llvm::sort(BinaryIds);
- BinaryIds.erase(std::unique(BinaryIds.begin(), BinaryIds.end()),
- BinaryIds.end());
-
- for (auto BI : BinaryIds) {
- // Increment by binary id length data type size.
- BinaryIdsSectionSize += sizeof(uint64_t);
- // Increment by binary id data length, aligned to 8 bytes.
- BinaryIdsSectionSize += alignToPowerOf2(BI.size(), sizeof(uint64_t));
- }
- // Write binary ids section size.
- OS.write(BinaryIdsSectionSize);
-
- for (auto BI : BinaryIds) {
- uint64_t BILen = BI.size();
- // Write binary id length.
- OS.write(BILen);
- // Write binary id data.
- for (unsigned K = 0; K < BILen; K++)
- OS.writeByte(BI[K]);
- // Write padding if necessary.
- uint64_t PaddingSize = alignToPowerOf2(BILen, sizeof(uint64_t)) - BILen;
- for (unsigned K = 0; K < PaddingSize; K++)
- OS.writeByte(0);
- }
-
// Allocate space for data to be serialized out.
std::unique_ptr<IndexedInstrProf::Summary> TheSummary =
IndexedInstrProf::allocSummary(SummarySize);
@@ -537,11 +487,8 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
PatchItem PatchItems[] = {
// Patch the Header.HashOffset field.
{HashTableStartFieldOffset, &HashTableStart, 1},
- // Patch the Header.MemProfOffset (=0 for profiles without MemProf
- // data).
+ // Patch the Header.MemProfOffset (=0 for profiles without MemProf data).
{MemProfSectionOffset, &MemProfSectionStart, 1},
- // Patch the Header.BinaryIdSectionOffset.
- {BinaryIdSectionOffset, &BinaryIdSectionStart, 1},
// Patch the summary data.
{SummaryOffset, reinterpret_cast<uint64_t *>(TheSummary.get()),
(int)(SummarySize / sizeof(uint64_t))},

View file

@ -1,106 +0,0 @@
The change in https://github.com/llvm/llvm-project/commit/1ae7d83803e45f6053ec6a606f259653846926b8
makes rustc unable to read the profiles that `llvm-profdata merge` outputs,
further causing some problems (e.g. bug 1811960).
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index af3c27ebac76..a6da1e0f3aec 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -291,10 +291,6 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
for (auto &Func : I.getValue())
addRecord(I.getKey(), Func.first, std::move(Func.second), 1, Warn);
- BinaryIds.reserve(BinaryIds.size() + IPW.BinaryIds.size());
- for (auto &I : IPW.BinaryIds)
- addBinaryIds(I);
-
MemProfFrameData.reserve(IPW.MemProfFrameData.size());
for (auto &I : IPW.MemProfFrameData) {
// If we weren't able to add the frame mappings then it doesn't make sense
@@ -339,7 +335,6 @@ static void setSummary(IndexedInstrProf::Summary *TheSummary,
Error InstrProfWriter::writeImpl(ProfOStream &OS) {
using namespace IndexedInstrProf;
- using namespace support;
OnDiskChainedHashTableGenerator<InstrProfRecordWriterTrait> Generator;
@@ -356,7 +351,7 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
// Write the header.
IndexedInstrProf::Header Header;
Header.Magic = IndexedInstrProf::Magic;
- Header.Version = IndexedInstrProf::ProfVersion::Version9;
+ Header.Version = IndexedInstrProf::ProfVersion::Version8;
if (static_cast<bool>(ProfileKind & InstrProfKind::IRInstrumentation))
Header.Version |= VARIANT_MASK_IR_PROF;
if (static_cast<bool>(ProfileKind & InstrProfKind::ContextSensitive))
@@ -396,12 +389,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
// profile contains memory profile information.
OS.write(0);
- // Save the location of binary ids section.
- uint64_t BinaryIdSectionOffset = OS.tell();
- // Reserve space for the BinaryIdOffset field to be patched later if this
- // profile contains binary ids.
- OS.write(0);
-
// Reserve space to write profile summary data.
uint32_t NumEntries = ProfileSummaryBuilder::DefaultCutoffs.size();
uint32_t SummarySize = Summary::getSize(Summary::NumKinds, NumEntries);
@@ -478,43 +465,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
OS.patch(PatchItems, 3);
}
- // BinaryIdSection has two parts:
- // 1. uint64_t BinaryIdsSectionSize
- // 2. list of binary ids that consist of:
- // a. uint64_t BinaryIdLength
- // b. uint8_t BinaryIdData
- // c. uint8_t Padding (if necessary)
- uint64_t BinaryIdSectionStart = OS.tell();
- // Calculate size of binary section.
- uint64_t BinaryIdsSectionSize = 0;
-
- // Remove duplicate binary ids.
- llvm::sort(BinaryIds);
- BinaryIds.erase(std::unique(BinaryIds.begin(), BinaryIds.end()),
- BinaryIds.end());
-
- for (auto BI : BinaryIds) {
- // Increment by binary id length data type size.
- BinaryIdsSectionSize += sizeof(uint64_t);
- // Increment by binary id data length, aligned to 8 bytes.
- BinaryIdsSectionSize += alignToPowerOf2(BI.size(), sizeof(uint64_t));
- }
- // Write binary ids section size.
- OS.write(BinaryIdsSectionSize);
-
- for (auto BI : BinaryIds) {
- uint64_t BILen = BI.size();
- // Write binary id length.
- OS.write(BILen);
- // Write binary id data.
- for (unsigned K = 0; K < BILen; K++)
- OS.writeByte(BI[K]);
- // Write padding if necessary.
- uint64_t PaddingSize = alignToPowerOf2(BILen, sizeof(uint64_t)) - BILen;
- for (unsigned K = 0; K < PaddingSize; K++)
- OS.writeByte(0);
- }
-
// Allocate space for data to be serialized out.
std::unique_ptr<IndexedInstrProf::Summary> TheSummary =
IndexedInstrProf::allocSummary(SummarySize);
@@ -537,11 +487,8 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
PatchItem PatchItems[] = {
// Patch the Header.HashOffset field.
{HashTableStartFieldOffset, &HashTableStart, 1},
- // Patch the Header.MemProfOffset (=0 for profiles without MemProf
- // data).
+ // Patch the Header.MemProfOffset (=0 for profiles without MemProf data).
{MemProfSectionOffset, &MemProfSectionStart, 1},
- // Patch the Header.BinaryIdSectionOffset.
- {BinaryIdSectionOffset, &BinaryIdSectionStart, 1},
// Patch the summary data.
{SummaryOffset, reinterpret_cast<uint64_t *>(TheSummary.get()),
(int)(SummarySize / sizeof(uint64_t))},