Skip to content

Commit 56926ae

Browse files
committed
[SampleFDO] Rename llvm-profdata flag -partial-profile to -gen-partial-profile.
The internal flag -partial-profile in llvm conflicts with the flag with the same name in llvm-profdata. The conflict happens in builds with LLVM_LINK_LLVM_DYLIB enabled. In this case the tools are linked with libLLVM and we end up with two definitions for the same cl::opt. The patch renames llvm-profdata flag -partial-profile to -gen-partial-profile.
1 parent 58bc507 commit 56926ae

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

llvm/test/tools/llvm-profdata/show-prof-info.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
REQUIRES: zlib
2-
; RUN: llvm-profdata merge -sample -extbinary -use-md5 -compress-all-sections -partial-profile -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile.proftext -o %t.1.output
2+
; RUN: llvm-profdata merge -sample -extbinary -use-md5 -compress-all-sections -gen-partial-profile -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile.proftext -o %t.1.output
33
; RUN: wc -c < %t.1.output > %t.txt
44
; RUN: llvm-profdata show -sample -show-sec-info-only %t.1.output >> %t.txt
55
; RUN: FileCheck %s --input-file=%t.txt

llvm/tools/llvm-profdata/llvm-profdata.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
449449
MemoryBuffer *Buffer,
450450
sampleprof::ProfileSymbolList &WriterList,
451451
bool CompressAllSections, bool UseMD5,
452-
bool PartialProfile) {
452+
bool GenPartialProfile) {
453453
populateProfileSymbolList(Buffer, WriterList);
454454
if (WriterList.size() > 0 && OutputFormat != PF_Ext_Binary)
455455
warn("Profile Symbol list is not empty but the output format is not "
@@ -469,9 +469,9 @@ static void handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
469469
else
470470
Writer.setUseMD5();
471471
}
472-
if (PartialProfile) {
472+
if (GenPartialProfile) {
473473
if (OutputFormat != PF_Ext_Binary)
474-
warn("-partial-profile is ignored. Specify -extbinary to enable it");
474+
warn("-gen-partial-profile is ignored. Specify -extbinary to enable it");
475475
else
476476
Writer.setPartialProfile();
477477
}
@@ -481,7 +481,7 @@ static void
481481
mergeSampleProfile(const WeightedFileVector &Inputs, SymbolRemapper *Remapper,
482482
StringRef OutputFilename, ProfileFormat OutputFormat,
483483
StringRef ProfileSymbolListFile, bool CompressAllSections,
484-
bool UseMD5, bool PartialProfile, FailureMode FailMode) {
484+
bool UseMD5, bool GenPartialProfile, FailureMode FailMode) {
485485
using namespace sampleprof;
486486
StringMap<FunctionSamples> ProfileMap;
487487
SmallVector<std::unique_ptr<sampleprof::SampleProfileReader>, 5> Readers;
@@ -538,7 +538,7 @@ mergeSampleProfile(const WeightedFileVector &Inputs, SymbolRemapper *Remapper,
538538
// Make sure Buffer lives as long as WriterList.
539539
auto Buffer = getInputFileBuf(ProfileSymbolListFile);
540540
handleExtBinaryWriter(*Writer, OutputFormat, Buffer.get(), WriterList,
541-
CompressAllSections, UseMD5, PartialProfile);
541+
CompressAllSections, UseMD5, GenPartialProfile);
542542
Writer->write(ProfileMap);
543543
}
544544

@@ -670,10 +670,9 @@ static int merge_main(int argc, const char *argv[]) {
670670
"use-md5", cl::init(false), cl::Hidden,
671671
cl::desc("Choose to use MD5 to represent string in name table (only "
672672
"meaningful for -extbinary)"));
673-
cl::opt<bool> PartialProfile(
674-
"partial-profile", cl::init(false), cl::Hidden,
675-
cl::desc("Set the profile to be a partial profile (only meaningful "
676-
"for -extbinary)"));
673+
cl::opt<bool> GenPartialProfile(
674+
"gen-partial-profile", cl::init(false), cl::Hidden,
675+
cl::desc("Generate a partial profile (only meaningful for -extbinary)"));
677676

678677
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");
679678

@@ -708,7 +707,7 @@ static int merge_main(int argc, const char *argv[]) {
708707
else
709708
mergeSampleProfile(WeightedInputs, Remapper.get(), OutputFilename,
710709
OutputFormat, ProfileSymbolListFile, CompressAllSections,
711-
UseMD5, PartialProfile, FailureMode);
710+
UseMD5, GenPartialProfile, FailureMode);
712711

713712
return 0;
714713
}

0 commit comments

Comments
 (0)