summaryrefslogtreecommitdiffstats
path: root/build/build-clang/partial-revert-llvmorg-17-init-7686-g244be0b0de19.patch
blob: 9f3c9a994a4f844358d7abba42eb77785541ba14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Revert profdata changes from https://github.com/llvm/llvm-project/commit/244be0b0de198fbe8a0861bb8f75509f610b57a4
that make 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 473fa35bfeec..3d324d91f10f 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -356,9 +356,6 @@ void InstrProfWriter::mergeRecordsFromWriter(InstrProfWriter &&IPW,
   for (auto &I : IPW.BinaryIds)
     addBinaryIds(I);
 
-  addTemporalProfileTraces(IPW.TemporalProfTraces,
-                           IPW.TemporalProfTraceStreamSize);
-
   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
@@ -420,7 +417,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::Version9;
   if (static_cast<bool>(ProfileKind & InstrProfKind::IRInstrumentation))
     Header.Version |= VARIANT_MASK_IR_PROF;
   if (static_cast<bool>(ProfileKind & InstrProfKind::ContextSensitive))
@@ -435,7 +432,7 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
   if (static_cast<bool>(ProfileKind & InstrProfKind::MemProf))
     Header.Version |= VARIANT_MASK_MEMPROF;
   if (static_cast<bool>(ProfileKind & InstrProfKind::TemporalProfile))
-    Header.Version |= VARIANT_MASK_TEMPORAL_PROF;
+    return make_error<InstrProfError>(instrprof_error::invalid_prof);
 
   Header.Unused = 0;
   Header.HashType = static_cast<uint64_t>(IndexedInstrProf::HashType);
@@ -469,9 +466,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
   // profile contains binary ids.
   OS.write(0);
 
-  uint64_t TemporalProfTracesOffset = OS.tell();
-  OS.write(0);
-
   // Reserve space to write profile summary data.
   uint32_t NumEntries = ProfileSummaryBuilder::DefaultCutoffs.size();
   uint32_t SummarySize = Summary::getSize(Summary::NumKinds, NumEntries);
@@ -585,19 +579,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
       OS.writeByte(0);
   }
 
-  uint64_t TemporalProfTracesSectionStart = 0;
-  if (static_cast<bool>(ProfileKind & InstrProfKind::TemporalProfile)) {
-    TemporalProfTracesSectionStart = OS.tell();
-    OS.write(TemporalProfTraces.size());
-    OS.write(TemporalProfTraceStreamSize);
-    for (auto &Trace : TemporalProfTraces) {
-      OS.write(Trace.Weight);
-      OS.write(Trace.FunctionNameRefs.size());
-      for (auto &NameRef : Trace.FunctionNameRefs)
-        OS.write(NameRef);
-    }
-  }
-
   // Allocate space for data to be serialized out.
   std::unique_ptr<IndexedInstrProf::Summary> TheSummary =
       IndexedInstrProf::allocSummary(SummarySize);
@@ -625,9 +606,6 @@ Error InstrProfWriter::writeImpl(ProfOStream &OS) {
       {MemProfSectionOffset, &MemProfSectionStart, 1},
       // Patch the Header.BinaryIdSectionOffset.
       {BinaryIdSectionOffset, &BinaryIdSectionStart, 1},
-      // Patch the Header.TemporalProfTracesOffset (=0 for profiles without
-      // traces).
-      {TemporalProfTracesOffset, &TemporalProfTracesSectionStart, 1},
       // Patch the summary data.
       {SummaryOffset, reinterpret_cast<uint64_t *>(TheSummary.get()),
        (int)(SummarySize / sizeof(uint64_t))},