[clang] debe80c - Revert "[memprof] Record BuildIDs in the raw profile."

Snehasish Kumar via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 13:10:01 PDT 2023


Author: Snehasish Kumar
Date: 2023-03-13T20:09:46Z
New Revision: debe80cb8d50275849d8d0b9357321eb7985b854

URL: https://github.com/llvm/llvm-project/commit/debe80cb8d50275849d8d0b9357321eb7985b854
DIFF: https://github.com/llvm/llvm-project/commit/debe80cb8d50275849d8d0b9357321eb7985b854.diff

LOG: Revert "[memprof] Record BuildIDs in the raw profile."

This reverts commit 287177a47a396ca6cc0bef7696108cdaa0c68e5f.

Added: 
    

Modified: 
    clang/test/CodeGen/Inputs/memprof.exe
    clang/test/CodeGen/Inputs/memprof.memprofraw
    compiler-rt/include/profile/MemProfData.inc
    compiler-rt/lib/memprof/memprof_allocator.cpp
    compiler-rt/lib/memprof/memprof_rawprofile.cpp
    compiler-rt/lib/memprof/memprof_rawprofile.h
    llvm/include/llvm/ProfileData/MemProfData.inc
    llvm/lib/ProfileData/RawMemProfReader.cpp
    llvm/test/Transforms/PGOProfile/Inputs/memprof.exe
    llvm/test/Transforms/PGOProfile/Inputs/memprof.memprofraw
    llvm/test/Transforms/PGOProfile/Inputs/memprof_pgo.profraw
    llvm/test/tools/llvm-profdata/Inputs/basic.memprofexe
    llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw
    llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe
    llvm/test/tools/llvm-profdata/Inputs/inline.memprofraw
    llvm/test/tools/llvm-profdata/Inputs/multi.memprofexe
    llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw
    llvm/test/tools/llvm-profdata/Inputs/pic.memprofexe
    llvm/test/tools/llvm-profdata/Inputs/pic.memprofraw
    llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh
    llvm/test/tools/llvm-profdata/memprof-basic.test
    llvm/test/tools/llvm-profdata/memprof-inline.test
    llvm/test/tools/llvm-profdata/memprof-multi.test

Removed: 
    llvm/test/tools/llvm-profdata/Inputs/buildid.memprofexe
    llvm/test/tools/llvm-profdata/Inputs/buildid.memprofraw
    llvm/test/tools/llvm-profdata/memprof-buildid.test


################################################################################
diff  --git a/clang/test/CodeGen/Inputs/memprof.exe b/clang/test/CodeGen/Inputs/memprof.exe
index c03b8b65c3b5b..ad7a0414e899e 100755
Binary files a/clang/test/CodeGen/Inputs/memprof.exe and b/clang/test/CodeGen/Inputs/memprof.exe 
diff er

diff  --git a/clang/test/CodeGen/Inputs/memprof.memprofraw b/clang/test/CodeGen/Inputs/memprof.memprofraw
index c3e0818e2ed10..e64214a51b086 100644
Binary files a/clang/test/CodeGen/Inputs/memprof.memprofraw and b/clang/test/CodeGen/Inputs/memprof.memprofraw 
diff er

diff  --git a/compiler-rt/include/profile/MemProfData.inc b/compiler-rt/include/profile/MemProfData.inc
index b82a4baf6dd74..c533073da751f 100644
--- a/compiler-rt/include/profile/MemProfData.inc
+++ b/compiler-rt/include/profile/MemProfData.inc
@@ -19,7 +19,6 @@
  * synced up.
  *
 \*===----------------------------------------------------------------------===*/
-#include <string.h>
 
 #ifdef _MSC_VER
 #define PACKED(...) __pragma(pack(push,1)) __VA_ARGS__ __pragma(pack(pop))
@@ -33,9 +32,7 @@
    (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | (uint64_t)'r' << 8 | (uint64_t)129)
 
 // The version number of the raw binary format.
-#define MEMPROF_RAW_VERSION 3ULL
-
-#define MEMPROF_BUILDID_MAX_SIZE 32ULL
+#define MEMPROF_RAW_VERSION 2ULL
 
 namespace llvm {
 namespace memprof {
@@ -49,40 +46,37 @@ PACKED(struct Header {
   uint64_t StackOffset;
 });
 
+
 // A struct describing the information necessary to describe a /proc/maps
 // segment entry for a particular binary/library identified by its build id.
 PACKED(struct SegmentEntry {
   uint64_t Start;
   uint64_t End;
   uint64_t Offset;
-  uint64_t BuildIdSize;
-  uint8_t BuildId[MEMPROF_BUILDID_MAX_SIZE] = {0};
+  // This field is unused until sanitizer procmaps support for build ids for
+  // Linux-Elf is implemented.
+  uint8_t BuildId[32] = {0};
 
-  // This constructor is only used in tests so don't set the BuildId.
-  SegmentEntry(uint64_t S, uint64_t E, uint64_t O)
-      : Start(S), End(E), Offset(O), BuildIdSize(0) {}
+  SegmentEntry(uint64_t S, uint64_t E, uint64_t O) :
+    Start(S), End(E), Offset(O) {}
 
   SegmentEntry(const SegmentEntry& S) {
     Start = S.Start;
     End = S.End;
     Offset = S.Offset;
-    BuildIdSize = S.BuildIdSize;
-    memcpy(BuildId, S.BuildId, S.BuildIdSize);
   }
 
   SegmentEntry& operator=(const SegmentEntry& S) {
     Start = S.Start;
     End = S.End;
     Offset = S.Offset;
-    BuildIdSize = S.BuildIdSize;
-    memcpy(BuildId, S.BuildId, S.BuildIdSize);
     return *this;
   }
 
   bool operator==(const SegmentEntry& S) const {
-    return Start == S.Start && End == S.End && Offset == S.Offset &&
-           BuildIdSize == S.BuildIdSize &&
-           memcmp(BuildId, S.BuildId, S.BuildIdSize) == 0;
+    return Start == S.Start &&
+           End == S.End &&
+           Offset == S.Offset;
   }
 });
 

diff  --git a/compiler-rt/lib/memprof/memprof_allocator.cpp b/compiler-rt/lib/memprof/memprof_allocator.cpp
index 751e4c40a72b2..6e3fa7f2dc7b1 100644
--- a/compiler-rt/lib/memprof/memprof_allocator.cpp
+++ b/compiler-rt/lib/memprof/memprof_allocator.cpp
@@ -23,11 +23,11 @@
 #include "sanitizer_common/sanitizer_allocator_checks.h"
 #include "sanitizer_common/sanitizer_allocator_interface.h"
 #include "sanitizer_common/sanitizer_allocator_report.h"
-#include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_errno.h"
 #include "sanitizer_common/sanitizer_file.h"
 #include "sanitizer_common/sanitizer_flags.h"
 #include "sanitizer_common/sanitizer_internal_defs.h"
+#include "sanitizer_common/sanitizer_procmaps.h"
 #include "sanitizer_common/sanitizer_stackdepot.h"
 
 #include <sched.h>
@@ -295,9 +295,8 @@ struct Allocator {
       // memprof_rawprofile.h.
       char *Buffer = nullptr;
 
-      __sanitizer::ListOfModules Modules;
-      Modules.init();
-      u64 BytesSerialized = SerializeToRawProfile(MIBMap, Modules, Buffer);
+      MemoryMappingLayout Layout(/*cache_enabled=*/true);
+      u64 BytesSerialized = SerializeToRawProfile(MIBMap, Layout, Buffer);
       CHECK(Buffer && BytesSerialized && "could not serialize to buffer");
       report_file.Write(Buffer, BytesSerialized);
     }

diff  --git a/compiler-rt/lib/memprof/memprof_rawprofile.cpp b/compiler-rt/lib/memprof/memprof_rawprofile.cpp
index d1447e7bb924a..88f3c34f85549 100644
--- a/compiler-rt/lib/memprof/memprof_rawprofile.cpp
+++ b/compiler-rt/lib/memprof/memprof_rawprofile.cpp
@@ -33,14 +33,12 @@ void RecordStackId(const uptr Key, UNUSED LockedMemInfoBlock *const &MIB,
 }
 } // namespace
 
-u64 SegmentSizeBytes(__sanitizer::ListOfModules &Modules) {
+u64 SegmentSizeBytes(MemoryMappingLayoutBase &Layout) {
   u64 NumSegmentsToRecord = 0;
-  for (const auto &Module : Modules) {
-    for (const auto &Segment : Module.ranges()) {
-      if (Segment.executable)
-        NumSegmentsToRecord++;
-    }
-  }
+  MemoryMappedSegment segment;
+  for (Layout.Reset(); Layout.Next(&segment);)
+    if (segment.IsReadable() && segment.IsExecutable())
+      NumSegmentsToRecord++;
 
   return sizeof(u64) // A header which stores the number of records.
          + sizeof(SegmentEntry) * NumSegmentsToRecord;
@@ -53,31 +51,28 @@ u64 SegmentSizeBytes(__sanitizer::ListOfModules &Modules) {
 // Start
 // End
 // Offset
-// UuidSize
-// Uuid 32B
+// BuildID 32B
 // ----------
 // ...
-void SerializeSegmentsToBuffer(__sanitizer::ListOfModules &Modules,
+void SerializeSegmentsToBuffer(MemoryMappingLayoutBase &Layout,
                                const u64 ExpectedNumBytes, char *&Buffer) {
   char *Ptr = Buffer;
   // Reserve space for the final count.
   Ptr += sizeof(u64);
 
   u64 NumSegmentsRecorded = 0;
-
-  for (const auto &Module : Modules) {
-    for (const auto &Segment : Module.ranges()) {
-      if (Segment.executable) {
-        SegmentEntry Entry(Segment.beg, Segment.end, Module.base_address());
-        CHECK(Module.uuid_size() <= MEMPROF_BUILDID_MAX_SIZE);
-        Entry.BuildIdSize = Module.uuid_size();
-        memcpy(Entry.BuildId, Module.uuid(), Module.uuid_size());
-        memcpy(Ptr, &Entry, sizeof(SegmentEntry));
-        Ptr += sizeof(SegmentEntry);
-        NumSegmentsRecorded++;
-      }
+  MemoryMappedSegment segment;
+
+  for (Layout.Reset(); Layout.Next(&segment);) {
+    if (segment.IsReadable() && segment.IsExecutable()) {
+      // TODO: Record segment.uuid when it is implemented for Linux-Elf.
+      SegmentEntry Entry(segment.start, segment.end, segment.offset);
+      memcpy(Ptr, &Entry, sizeof(SegmentEntry));
+      Ptr += sizeof(SegmentEntry);
+      NumSegmentsRecorded++;
     }
   }
+
   // Store the number of segments we recorded in the space we reserved.
   *((u64 *)Buffer) = NumSegmentsRecorded;
   CHECK(ExpectedNumBytes >= static_cast<u64>(Ptr - Buffer) &&
@@ -203,11 +198,11 @@ void SerializeMIBInfoToBuffer(MIBMapTy &MIBMap, const Vector<u64> &StackIds,
 // ----------
 // Optional Padding Bytes
 // ...
-u64 SerializeToRawProfile(MIBMapTy &MIBMap, __sanitizer::ListOfModules &Modules,
+u64 SerializeToRawProfile(MIBMapTy &MIBMap, MemoryMappingLayoutBase &Layout,
                           char *&Buffer) {
   // Each section size is rounded up to 8b since the first entry in each section
   // is a u64 which holds the number of entries in the section by convention.
-  const u64 NumSegmentBytes = RoundUpTo(SegmentSizeBytes(Modules), 8);
+  const u64 NumSegmentBytes = RoundUpTo(SegmentSizeBytes(Layout), 8);
 
   Vector<u64> StackIds;
   MIBMap.ForEach(RecordStackId, reinterpret_cast<void *>(&StackIds));
@@ -237,7 +232,7 @@ u64 SerializeToRawProfile(MIBMapTy &MIBMap, __sanitizer::ListOfModules &Modules,
                 sizeof(Header) + NumSegmentBytes + NumMIBInfoBytes};
   Ptr = WriteBytes(header, Ptr);
 
-  SerializeSegmentsToBuffer(Modules, NumSegmentBytes, Ptr);
+  SerializeSegmentsToBuffer(Layout, NumSegmentBytes, Ptr);
   Ptr += NumSegmentBytes;
 
   SerializeMIBInfoToBuffer(MIBMap, StackIds, NumMIBInfoBytes, Ptr);

diff  --git a/compiler-rt/lib/memprof/memprof_rawprofile.h b/compiler-rt/lib/memprof/memprof_rawprofile.h
index 6a54b058ea802..575104e7e34eb 100644
--- a/compiler-rt/lib/memprof/memprof_rawprofile.h
+++ b/compiler-rt/lib/memprof/memprof_rawprofile.h
@@ -2,13 +2,13 @@
 #define MEMPROF_RAWPROFILE_H_
 
 #include "memprof_mibmap.h"
-#include "sanitizer_common/sanitizer_common.h"
+#include "sanitizer_common/sanitizer_procmaps.h"
 
 namespace __memprof {
 // Serialize the in-memory representation of the memprof profile to the raw
 // binary format. The format itself is documented memprof_rawprofile.cpp.
-u64 SerializeToRawProfile(MIBMapTy &BlockCache,
-                          __sanitizer::ListOfModules &Modules, char *&Buffer);
+u64 SerializeToRawProfile(MIBMapTy &BlockCache, MemoryMappingLayoutBase &Layout,
+                          char *&Buffer);
 } // namespace __memprof
 
 #endif // MEMPROF_RAWPROFILE_H_

diff  --git a/llvm/include/llvm/ProfileData/MemProfData.inc b/llvm/include/llvm/ProfileData/MemProfData.inc
index b82a4baf6dd74..c533073da751f 100644
--- a/llvm/include/llvm/ProfileData/MemProfData.inc
+++ b/llvm/include/llvm/ProfileData/MemProfData.inc
@@ -19,7 +19,6 @@
  * synced up.
  *
 \*===----------------------------------------------------------------------===*/
-#include <string.h>
 
 #ifdef _MSC_VER
 #define PACKED(...) __pragma(pack(push,1)) __VA_ARGS__ __pragma(pack(pop))
@@ -33,9 +32,7 @@
    (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | (uint64_t)'r' << 8 | (uint64_t)129)
 
 // The version number of the raw binary format.
-#define MEMPROF_RAW_VERSION 3ULL
-
-#define MEMPROF_BUILDID_MAX_SIZE 32ULL
+#define MEMPROF_RAW_VERSION 2ULL
 
 namespace llvm {
 namespace memprof {
@@ -49,40 +46,37 @@ PACKED(struct Header {
   uint64_t StackOffset;
 });
 
+
 // A struct describing the information necessary to describe a /proc/maps
 // segment entry for a particular binary/library identified by its build id.
 PACKED(struct SegmentEntry {
   uint64_t Start;
   uint64_t End;
   uint64_t Offset;
-  uint64_t BuildIdSize;
-  uint8_t BuildId[MEMPROF_BUILDID_MAX_SIZE] = {0};
+  // This field is unused until sanitizer procmaps support for build ids for
+  // Linux-Elf is implemented.
+  uint8_t BuildId[32] = {0};
 
-  // This constructor is only used in tests so don't set the BuildId.
-  SegmentEntry(uint64_t S, uint64_t E, uint64_t O)
-      : Start(S), End(E), Offset(O), BuildIdSize(0) {}
+  SegmentEntry(uint64_t S, uint64_t E, uint64_t O) :
+    Start(S), End(E), Offset(O) {}
 
   SegmentEntry(const SegmentEntry& S) {
     Start = S.Start;
     End = S.End;
     Offset = S.Offset;
-    BuildIdSize = S.BuildIdSize;
-    memcpy(BuildId, S.BuildId, S.BuildIdSize);
   }
 
   SegmentEntry& operator=(const SegmentEntry& S) {
     Start = S.Start;
     End = S.End;
     Offset = S.Offset;
-    BuildIdSize = S.BuildIdSize;
-    memcpy(BuildId, S.BuildId, S.BuildIdSize);
     return *this;
   }
 
   bool operator==(const SegmentEntry& S) const {
-    return Start == S.Start && End == S.End && Offset == S.Offset &&
-           BuildIdSize == S.BuildIdSize &&
-           memcmp(BuildId, S.BuildId, S.BuildIdSize) == 0;
+    return Start == S.Start &&
+           End == S.End &&
+           Offset == S.Offset;
   }
 });
 

diff  --git a/llvm/lib/ProfileData/RawMemProfReader.cpp b/llvm/lib/ProfileData/RawMemProfReader.cpp
index dd62a2f8a0f6c..958bbc551f281 100644
--- a/llvm/lib/ProfileData/RawMemProfReader.cpp
+++ b/llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -158,13 +158,15 @@ bool isRuntimePath(const StringRef Path) {
 }
 
 std::string getBuildIdString(const SegmentEntry &Entry) {
+  constexpr size_t Size = sizeof(Entry.BuildId) / sizeof(uint8_t);
+  constexpr uint8_t Zeros[Size] = {0};
   // If the build id is unset print a helpful string instead of all zeros.
-  if (Entry.BuildIdSize == 0)
+  if (memcmp(Entry.BuildId, Zeros, Size) == 0)
     return "<None>";
 
   std::string Str;
   raw_string_ostream OS(Str);
-  for (size_t I = 0; I < Entry.BuildIdSize; I++) {
+  for (size_t I = 0; I < Size; I++) {
     OS << format_hex_no_prefix(Entry.BuildId[I], 2);
   }
   return OS.str();

diff  --git a/llvm/test/Transforms/PGOProfile/Inputs/memprof.exe b/llvm/test/Transforms/PGOProfile/Inputs/memprof.exe
index b10c2f9c72147..0ed40163919cc 100755
Binary files a/llvm/test/Transforms/PGOProfile/Inputs/memprof.exe and b/llvm/test/Transforms/PGOProfile/Inputs/memprof.exe 
diff er

diff  --git a/llvm/test/Transforms/PGOProfile/Inputs/memprof.memprofraw b/llvm/test/Transforms/PGOProfile/Inputs/memprof.memprofraw
index 790249a44b0d1..7511ca78474f5 100644
Binary files a/llvm/test/Transforms/PGOProfile/Inputs/memprof.memprofraw and b/llvm/test/Transforms/PGOProfile/Inputs/memprof.memprofraw 
diff er

diff  --git a/llvm/test/Transforms/PGOProfile/Inputs/memprof_pgo.profraw b/llvm/test/Transforms/PGOProfile/Inputs/memprof_pgo.profraw
index d5160e75d5ec2..04330fe95a0bb 100644
Binary files a/llvm/test/Transforms/PGOProfile/Inputs/memprof_pgo.profraw and b/llvm/test/Transforms/PGOProfile/Inputs/memprof_pgo.profraw 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/basic.memprofexe b/llvm/test/tools/llvm-profdata/Inputs/basic.memprofexe
index 9db8618e485e5..d321a05e6d3e7 100755
Binary files a/llvm/test/tools/llvm-profdata/Inputs/basic.memprofexe and b/llvm/test/tools/llvm-profdata/Inputs/basic.memprofexe 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw b/llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw
index 66210b4cee676..612eaa0b54ca6 100644
Binary files a/llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw and b/llvm/test/tools/llvm-profdata/Inputs/basic.memprofraw 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofexe b/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofexe
deleted file mode 100755
index 103667b3df72d..0000000000000
Binary files a/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofexe and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofraw b/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofraw
deleted file mode 100644
index 11579b2930901..0000000000000
Binary files a/llvm/test/tools/llvm-profdata/Inputs/buildid.memprofraw and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe b/llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe
index 3bc3ff276e83d..6a5594eb7b207 100755
Binary files a/llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe and b/llvm/test/tools/llvm-profdata/Inputs/inline.memprofexe 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/inline.memprofraw b/llvm/test/tools/llvm-profdata/Inputs/inline.memprofraw
index dad562e6cf2c6..8e0ad196057af 100644
Binary files a/llvm/test/tools/llvm-profdata/Inputs/inline.memprofraw and b/llvm/test/tools/llvm-profdata/Inputs/inline.memprofraw 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/multi.memprofexe b/llvm/test/tools/llvm-profdata/Inputs/multi.memprofexe
index 65ce4445c8388..02100d049d61b 100755
Binary files a/llvm/test/tools/llvm-profdata/Inputs/multi.memprofexe and b/llvm/test/tools/llvm-profdata/Inputs/multi.memprofexe 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw b/llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw
index 651e62566f40f..875669884afd5 100644
Binary files a/llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw and b/llvm/test/tools/llvm-profdata/Inputs/multi.memprofraw 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/pic.memprofexe b/llvm/test/tools/llvm-profdata/Inputs/pic.memprofexe
index 8a3ddeb2fe02b..900a453bc1460 100755
Binary files a/llvm/test/tools/llvm-profdata/Inputs/pic.memprofexe and b/llvm/test/tools/llvm-profdata/Inputs/pic.memprofexe 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/pic.memprofraw b/llvm/test/tools/llvm-profdata/Inputs/pic.memprofraw
index 4ef5eee1aba89..b56b9a98a7c8e 100644
Binary files a/llvm/test/tools/llvm-profdata/Inputs/pic.memprofraw and b/llvm/test/tools/llvm-profdata/Inputs/pic.memprofraw 
diff er

diff  --git a/llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh b/llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh
index 5365a0bb6cc3a..e709254d59629 100755
--- a/llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh
+++ b/llvm/test/tools/llvm-profdata/Inputs/update_memprof_inputs.sh
@@ -72,7 +72,6 @@ INPUTS["basic"]="BASIC"
 INPUTS["inline"]="INLINE"
 INPUTS["multi"]="MULTI"
 INPUTS["pic"]="BASIC;-pie"
-INPUTS["buildid"]="BASIC;-Wl,-build-id=sha1"
 
 for name in "${!INPUTS[@]}"; do
   IFS=";" read -r src flags <<< "${INPUTS[$name]}"

diff  --git a/llvm/test/tools/llvm-profdata/memprof-basic.test b/llvm/test/tools/llvm-profdata/memprof-basic.test
index 8eaa2fa1013f4..2d1725188cc19 100644
--- a/llvm/test/tools/llvm-profdata/memprof-basic.test
+++ b/llvm/test/tools/llvm-profdata/memprof-basic.test
@@ -8,17 +8,17 @@ additional allocations which do not originate from the main binary are pruned.
 
 CHECK:  MemprofProfile:
 CHECK-NEXT:   Summary:
-CHECK-NEXT:     Version: 3
+CHECK-NEXT:     Version: 2
 CHECK-NEXT:     NumSegments: {{[0-9]+}}
 CHECK-NEXT:     NumMibInfo: 2
 CHECK-NEXT:     NumAllocFunctions: 1
 CHECK-NEXT:     NumStackOffsets: 2
 CHECK-NEXT:   Segments:
 CHECK-NEXT:   -
-CHECK-NEXT:     BuildId: {{[[:xdigit:]]+}}
-CHECK-NEXT:     Start: 0x{{[[:xdigit:]]+}}
-CHECK-NEXT:     End: 0x{{[[:xdigit:]]+}}
-CHECK-NEXT:     Offset: 0x{{[[:xdigit:]]+}}
+CHECK-NEXT:     BuildId: <None>
+CHECK-NEXT:     Start: 0x{{[0-9]+}}
+CHECK-NEXT:     End: 0x{{[0-9]+}}
+CHECK-NEXT:     Offset: 0x{{[0-9]+}}
 CHECK-NEXT:   -
 
 CHECK:   Records:

diff  --git a/llvm/test/tools/llvm-profdata/memprof-buildid.test b/llvm/test/tools/llvm-profdata/memprof-buildid.test
deleted file mode 100644
index 9b055d3a70bbe..0000000000000
--- a/llvm/test/tools/llvm-profdata/memprof-buildid.test
+++ /dev/null
@@ -1,12 +0,0 @@
-REQUIRES: x86_64-linux
-
-To update the inputs used below run Inputs/update_memprof_inputs.sh /path/to/updated/clang
-RUN: llvm-readelf --notes %p/Inputs/buildid.memprofexe > %t1.txt
-RUN: llvm-profdata show --memory %p/Inputs/buildid.memprofraw --profiled-binary %p/Inputs/buildid.memprofexe -o -  > %t2.txt
-RUN: cat %t1.txt %t2.txt | FileCheck %s
-
-COM: First extract the id from the llvm-readelf output.
-CHECK: Build ID: [[ID:[[:xdigit:]]+]]
-
-COM: Then match it with the profdata output.
-CHECK: BuildId: {{.*}}[[ID]]

diff  --git a/llvm/test/tools/llvm-profdata/memprof-inline.test b/llvm/test/tools/llvm-profdata/memprof-inline.test
index dd842c0542083..571beb921ea0c 100644
--- a/llvm/test/tools/llvm-profdata/memprof-inline.test
+++ b/llvm/test/tools/llvm-profdata/memprof-inline.test
@@ -5,17 +5,17 @@ RUN: llvm-profdata show --memory %p/Inputs/inline.memprofraw --profiled-binary %
 
 CHECK:  MemprofProfile:
 CHECK-NEXT:  Summary:
-CHECK-NEXT:    Version: 3
+CHECK-NEXT:    Version: 2
 CHECK-NEXT:    NumSegments: {{[0-9]+}}
 CHECK-NEXT:    NumMibInfo: 2
 CHECK-NEXT:    NumAllocFunctions: 2
 CHECK-NEXT:    NumStackOffsets: 1
 CHECK-NEXT:  Segments:
 CHECK-NEXT:  -
-CHECK-NEXT:    BuildId: {{[[:xdigit:]]+}}
-CHECK-NEXT:    Start: 0x{{[[:xdigit:]]+}}
-CHECK-NEXT:    End: 0x{{[[:xdigit:]]+}}
-CHECK-NEXT:    Offset: 0x{{[[:xdigit:]]+}}
+CHECK-NEXT:    BuildId: <None>
+CHECK-NEXT:    Start: 0x{{[0-9]+}}
+CHECK-NEXT:    End: 0x{{[0-9]+}}
+CHECK-NEXT:    Offset: 0x{{[0-9]+}}
 CHECK-NEXT:  -
 
 CHECK:  Records:

diff  --git a/llvm/test/tools/llvm-profdata/memprof-multi.test b/llvm/test/tools/llvm-profdata/memprof-multi.test
index f3cdbd1f5266c..5918a957bd6f7 100644
--- a/llvm/test/tools/llvm-profdata/memprof-multi.test
+++ b/llvm/test/tools/llvm-profdata/memprof-multi.test
@@ -7,7 +7,7 @@ We expect 2 MIB entries, 1 each for the malloc calls in the program.
 
 CHECK:  MemprofProfile:
 CHECK-NEXT:  Summary:
-CHECK-NEXT:    Version: 3
+CHECK-NEXT:    Version: 2
 CHECK-NEXT:    NumSegments: {{[0-9]+}}
 CHECK-NEXT:    NumMibInfo: 2
 CHECK-NEXT:    NumAllocFunctions: 1


        


More information about the cfe-commits mailing list