aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2024-03-08 12:27:46 -0800
committerGitHub <noreply@github.com>2024-03-08 12:27:46 -0800
commit08ddd2ce4048b0adbddc3ab9b770ccf43f81d65d (patch)
tree1eb7c7451a8ada097172b01012e5fcc4a7d9f45c /llvm/tools/llvm-profdata/llvm-profdata.cpp
parent300a39bdad4593fdc2618eb28f6e838df735619a (diff)
downloadllvm-08ddd2ce4048b0adbddc3ab9b770ccf43f81d65d.zip
llvm-08ddd2ce4048b0adbddc3ab9b770ccf43f81d65d.tar.gz
llvm-08ddd2ce4048b0adbddc3ab9b770ccf43f81d65d.tar.bz2
[PGO] Add support for writing previous indexed format (#84505)
Enable temporary support to ease use of new llvm-profdata with slightly older indexed profiles after 16e74fd48988ac95551d0f64e1b36f78a82a89a2, which bumped the indexed format for type profiling.
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 8400b07..3a7bd06 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -291,6 +291,15 @@ cl::opt<bool> DropProfileSymbolList(
cl::desc("Drop the profile symbol list when merging AutoFDO profiles "
"(only meaningful for -sample)"));
+// Temporary support for writing the previous version of the format, to enable
+// some forward compatibility.
+// TODO: Consider enabling this with future version changes as well, to ease
+// deployment of newer versions of llvm-profdata.
+cl::opt<bool> DoWritePrevVersion(
+ "write-prev-version", cl::init(false), cl::Hidden,
+ cl::desc("Write the previous version of indexed format, to enable "
+ "some forward compatibility."));
+
// Options specific to overlap subcommand.
cl::opt<std::string> BaseFilename(cl::Positional, cl::Required,
cl::desc("<base profile file>"),
@@ -579,8 +588,8 @@ struct WriterContext {
WriterContext(bool IsSparse, std::mutex &ErrLock,
SmallSet<instrprof_error, 4> &WriterErrorCodes,
uint64_t ReservoirSize = 0, uint64_t MaxTraceLength = 0)
- : Writer(IsSparse, ReservoirSize, MaxTraceLength), ErrLock(ErrLock),
- WriterErrorCodes(WriterErrorCodes) {}
+ : Writer(IsSparse, ReservoirSize, MaxTraceLength, DoWritePrevVersion),
+ ErrLock(ErrLock), WriterErrorCodes(WriterErrorCodes) {}
};
/// Computer the overlap b/w profile BaseFilename and TestFileName,