[llvm] 27b7c1e - Revert "[memprof] Fix frame deserialization on big endian systems."
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 17 15:56:04 PST 2022
Author: Snehasish Kumar
Date: 2022-02-17T15:51:04-08:00
New Revision: 27b7c1e3f5e01b00781c6cc0d19e8f0446e79d9f
URL: https://github.com/llvm/llvm-project/commit/27b7c1e3f5e01b00781c6cc0d19e8f0446e79d9f
DIFF: https://github.com/llvm/llvm-project/commit/27b7c1e3f5e01b00781c6cc0d19e8f0446e79d9f.diff
LOG: Revert "[memprof] Fix frame deserialization on big endian systems."
This reverts commit c74389b4b58d8db3f8262ce15b9d514d62fe265c.
This broke the ml-opt-x86-64 build.
https://lab.llvm.org/buildbot#builders/9/builds/4127
Added:
Modified:
llvm/include/llvm/ProfileData/MemProf.h
llvm/lib/ProfileData/MemProf.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h
index 07bf629ce146a..dcc9b69386e8a 100644
--- a/llvm/include/llvm/ProfileData/MemProf.h
+++ b/llvm/include/llvm/ProfileData/MemProf.h
@@ -161,7 +161,7 @@ struct MemProfRecord {
bool operator!=(const Frame &Other) const { return !operator==(Other); }
// Write the contents of the frame to the ostream \p OS.
- void serialize(raw_ostream & OS) const {
+ void write(raw_ostream & OS) const {
using namespace support;
endian::Writer LE(OS, little);
@@ -176,22 +176,6 @@ struct MemProfRecord {
LE.write<uint32_t>(Column);
LE.write<bool>(IsInlineFrame);
}
-
- // Read a frame from char data which has been serialized as little endian.
- static Frame deserialize(const unsigned char *Ptr) {
- using namespace support;
- return Frame(
- /*Function=*/endian::readNext<uint64_t, little, unaligned>(Ptr),
- /*LineOffset=*/endian::readNext<uint32_t, little, unaligned>(Ptr),
- /*Column=*/endian::readNext<uint32_t, little, unaligned>(Ptr),
- /*IsInlineFrame=*/endian::readNext<bool, little, unaligned>(Ptr));
- }
-
- // Returns the size of the frame information.
- static constexpr size_t serializedSize() {
- return sizeof(Frame::Function) + sizeof(Frame::LineOffset) +
- sizeof(Frame::Column) + sizeof(Frame::IsInlineFrame);
- }
});
// The dynamic calling context for the allocation.
diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index 48950d41d0234..6a9b69ff6cff0 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -15,7 +15,7 @@ void serializeRecords(const ArrayRef<MemProfRecord> Records,
for (const MemProfRecord &MR : Records) {
LE.write<uint64_t>(MR.CallStack.size());
for (const MemProfRecord::Frame &F : MR.CallStack) {
- F.serialize(OS);
+ F.write(OS);
}
MR.Info.serialize(Schema, OS);
}
@@ -33,8 +33,8 @@ SmallVector<MemProfRecord, 4> deserializeRecords(const MemProfSchema &Schema,
const uint64_t NumFrames =
endian::readNext<uint64_t, little, unaligned>(Ptr);
for (uint64_t J = 0; J < NumFrames; J++) {
- const auto F = MemProfRecord::Frame::deserialize(Ptr);
- Ptr += MemProfRecord::Frame::serializedSize();
+ const auto F = *reinterpret_cast<const MemProfRecord::Frame *>(Ptr);
+ Ptr += sizeof(MemProfRecord::Frame);
MR.CallStack.push_back(F);
}
MR.Info.deserialize(Schema, Ptr);
More information about the llvm-commits
mailing list