[llvm] [llvm-profdata] Default to MemProf version 3 (PR #108863)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 11:23:17 PDT 2024


https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/108863

>From 0251babfbe20a66a762636248bb54b5bfe1cac70 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 16 Sep 2024 10:22:52 -0700
Subject: [PATCH 1/2] [llvm-profdata] Default to MemProf version 3

It's very confusing to have support for Verion 3 but not default to
it.  This patch teaches llvm-profdata to use MemProf version 3 by
default.
---
 llvm/tools/llvm-profdata/llvm-profdata.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 17933e4500ead6..c235c3f2b105e1 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -332,7 +332,7 @@ cl::opt<bool> DoWritePrevVersion(
 cl::opt<memprof::IndexedVersion> MemProfVersionRequested(
     "memprof-version", cl::Hidden, cl::sub(MergeSubcommand),
     cl::desc("Specify the version of the memprof format to use"),
-    cl::init(memprof::Version0),
+    cl::init(memprof::Version3),
     cl::values(clEnumValN(memprof::Version0, "0", "version 0"),
                clEnumValN(memprof::Version1, "1", "version 1"),
                clEnumValN(memprof::Version2, "2", "version 2"),

>From febd0642a410642710576d2a466b8f31043799f5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 10 Oct 2024 11:22:16 -0700
Subject: [PATCH 2/2] Add a test.

---
 llvm/test/tools/llvm-profdata/memprof-merge-versions.test | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/test/tools/llvm-profdata/memprof-merge-versions.test b/llvm/test/tools/llvm-profdata/memprof-merge-versions.test
index aa7d0329425dc5..144afdd92a1149 100644
--- a/llvm/test/tools/llvm-profdata/memprof-merge-versions.test
+++ b/llvm/test/tools/llvm-profdata/memprof-merge-versions.test
@@ -25,6 +25,10 @@ RUN: llvm-profdata show %t.prof.v3 | FileCheck %s
 RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=3 --memprof-full-schema --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v3
 RUN: llvm-profdata show %t.prof.v3 | FileCheck %s
 
+Check to see if llvm-profdata produces V3 by default.
+RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-full-schema --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.default
+RUN: cmp %t.prof.default %t.prof.v3
+
 For now we only check the validity of the instrumented profile since we don't
 have a way to display the contents of the memprof indexed format yet.
 



More information about the llvm-commits mailing list