Skip to content

Conversation

kazutakahirata
Copy link
Contributor

I'm planning to remove the V2 support. Now, some functions and tests
should not be removed just because they have "v2" in their names.
This patch renames them.

  • makeRecordV2: Renamed to makeRecord. This has "V2" in the name
    because the concept of call stack ID came out as part of V2. It is
    still useful for use with V3 and V4.

  • test_memprof_v4_{partial,full}_schema: Upgraded to use V4. These
    tests perform serialization/deserialization roundtrip tests of a
    MemProfRecord with {partial,full} schema.

I'm planning to remove the V2 support.  Now, some functions and tests
should not be removed just because they have "v2" in their names.
This patch renames them.

- makeRecordV2: Renamed to makeRecord.  This has "V2" in the name
  because the concept of call stack ID came out as part of V2.  It is
  still useful for use with V3 and V4.

- test_memprof_v4_{partial,full}_schema: Upgraded to use V4.  These
  tests perform serialization/deserialization roundtrip tests of a
  MemProfRecord with {partial,full} schema.
@llvmbot llvmbot added the PGO Profile Guided Optimizations label Aug 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 31, 2025

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

Changes

I'm planning to remove the V2 support. Now, some functions and tests
should not be removed just because they have "v2" in their names.
This patch renames them.

  • makeRecordV2: Renamed to makeRecord. This has "V2" in the name
    because the concept of call stack ID came out as part of V2. It is
    still useful for use with V3 and V4.

  • test_memprof_v4_{partial,full}_schema: Upgraded to use V4. These
    tests perform serialization/deserialization roundtrip tests of a
    MemProfRecord with {partial,full} schema.


Full diff: https://github.com/llvm/llvm-project/pull/156247.diff

1 Files Affected:

  • (modified) llvm/unittests/ProfileData/InstrProfTest.cpp (+11-11)
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index 6467695355be8..dd17844aef8a6 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -392,9 +392,9 @@ MemInfoBlock makePartialMIB() {
 }
 
 IndexedMemProfRecord
-makeRecordV2(std::initializer_list<::llvm::memprof::CallStackId> AllocFrames,
-             std::initializer_list<::llvm::memprof::CallStackId> CallSiteFrames,
-             const MemInfoBlock &Block, const memprof::MemProfSchema &Schema) {
+makeRecord(std::initializer_list<::llvm::memprof::CallStackId> AllocFrames,
+           std::initializer_list<::llvm::memprof::CallStackId> CallSiteFrames,
+           const MemInfoBlock &Block, const memprof::MemProfSchema &Schema) {
   IndexedMemProfRecord MR;
   for (const auto &CSId : AllocFrames)
     MR.AllocSites.emplace_back(CSId, Block, Schema);
@@ -436,16 +436,16 @@ MATCHER_P(EqualsRecord, Want, "") {
   return true;
 }
 
-TEST_F(InstrProfTest, test_memprof_v2_full_schema) {
+TEST_F(InstrProfTest, test_memprof_v4_full_schema) {
   const MemInfoBlock MIB = makeFullMIB();
 
-  Writer.setMemProfVersionRequested(memprof::Version2);
+  Writer.setMemProfVersionRequested(memprof::Version4);
   Writer.setMemProfFullSchema(true);
 
   ASSERT_THAT_ERROR(Writer.mergeProfileKind(InstrProfKind::MemProf),
                     Succeeded());
 
-  const IndexedMemProfRecord IndexedMR = makeRecordV2(
+  const IndexedMemProfRecord IndexedMR = makeRecord(
       /*AllocFrames=*/{0x111, 0x222},
       /*CallSiteFrames=*/{0x333}, MIB, memprof::getFullSchema());
   IndexedMemProfData MemProfData = getMemProfDataForTest();
@@ -470,16 +470,16 @@ TEST_F(InstrProfTest, test_memprof_v2_full_schema) {
   EXPECT_THAT(WantRecord, EqualsRecord(Record));
 }
 
-TEST_F(InstrProfTest, test_memprof_v2_partial_schema) {
+TEST_F(InstrProfTest, test_memprof_v4_partial_schema) {
   const MemInfoBlock MIB = makePartialMIB();
 
-  Writer.setMemProfVersionRequested(memprof::Version2);
+  Writer.setMemProfVersionRequested(memprof::Version4);
   Writer.setMemProfFullSchema(false);
 
   ASSERT_THAT_ERROR(Writer.mergeProfileKind(InstrProfKind::MemProf),
                     Succeeded());
 
-  const IndexedMemProfRecord IndexedMR = makeRecordV2(
+  const IndexedMemProfRecord IndexedMR = makeRecord(
       /*AllocFrames=*/{0x111, 0x222},
       /*CallSiteFrames=*/{0x333}, MIB, memprof::getHotColdSchema());
   IndexedMemProfData MemProfData = getMemProfDataForTest();
@@ -525,7 +525,7 @@ TEST_F(InstrProfTest, test_caller_callee_pairs) {
   //       Line: 7, Column: 8
   //         new(...)
 
-  const IndexedMemProfRecord IndexedMR = makeRecordV2(
+  const IndexedMemProfRecord IndexedMR = makeRecord(
       /*AllocFrames=*/{0x111, 0x222},
       /*CallSiteFrames=*/{}, MIB, memprof::getHotColdSchema());
 
@@ -584,7 +584,7 @@ TEST_F(InstrProfTest, test_memprof_merge) {
   ASSERT_THAT_ERROR(Writer2.mergeProfileKind(InstrProfKind::MemProf),
                     Succeeded());
 
-  const IndexedMemProfRecord IndexedMR = makeRecordV2(
+  const IndexedMemProfRecord IndexedMR = makeRecord(
       /*AllocFrames=*/{0x111, 0x222},
       /*CallSiteFrames=*/{}, makePartialMIB(), memprof::getHotColdSchema());
 

@kazutakahirata kazutakahirata merged commit 8bc2eb8 into llvm:main Sep 2, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the memprof_drop_v2_prep branch September 2, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants