[llvm] 56926ae - [SampleFDO] Rename llvm-profdata flag -partial-profile to -gen-partial-profile.

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 15:10:53 PDT 2020


Command line guide needs to be updated too.

David

On Tue, May 12, 2020 at 3:06 PM Wei Mi via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

>
> Author: Wei Mi
> Date: 2020-05-12T15:06:03-07:00
> New Revision: 56926ae0faa67ac4c3b75609bfeea2eb324c0851
>
> URL:
> https://github.com/llvm/llvm-project/commit/56926ae0faa67ac4c3b75609bfeea2eb324c0851
> DIFF:
> https://github.com/llvm/llvm-project/commit/56926ae0faa67ac4c3b75609bfeea2eb324c0851.diff
>
> LOG: [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.
>
> Added:
>
>
> Modified:
>     llvm/test/tools/llvm-profdata/show-prof-info.test
>     llvm/tools/llvm-profdata/llvm-profdata.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff  --git a/llvm/test/tools/llvm-profdata/show-prof-info.test
> b/llvm/test/tools/llvm-profdata/show-prof-info.test
> index ca91051dc1c8..4a748667d1ad 100644
> --- a/llvm/test/tools/llvm-profdata/show-prof-info.test
> +++ b/llvm/test/tools/llvm-profdata/show-prof-info.test
> @@ -1,5 +1,5 @@
>  REQUIRES: zlib
> -; 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
> +; 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
>  ; RUN: wc -c < %t.1.output > %t.txt
>  ; RUN: llvm-profdata show -sample -show-sec-info-only %t.1.output >>
> %t.txt
>  ; RUN: FileCheck %s --input-file=%t.txt
>
> diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp
> b/llvm/tools/llvm-profdata/llvm-profdata.cpp
> index 6d2f636b35e9..3d0e820d2f59 100644
> --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
> +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
> @@ -449,7 +449,7 @@ static void
> handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
>                                    MemoryBuffer *Buffer,
>                                    sampleprof::ProfileSymbolList
> &WriterList,
>                                    bool CompressAllSections, bool UseMD5,
> -                                  bool PartialProfile) {
> +                                  bool GenPartialProfile) {
>    populateProfileSymbolList(Buffer, WriterList);
>    if (WriterList.size() > 0 && OutputFormat != PF_Ext_Binary)
>      warn("Profile Symbol list is not empty but the output format is not "
> @@ -469,9 +469,9 @@ static void
> handleExtBinaryWriter(sampleprof::SampleProfileWriter &Writer,
>      else
>        Writer.setUseMD5();
>    }
> -  if (PartialProfile) {
> +  if (GenPartialProfile) {
>      if (OutputFormat != PF_Ext_Binary)
> -      warn("-partial-profile is ignored. Specify -extbinary to enable
> it");
> +      warn("-gen-partial-profile is ignored. Specify -extbinary to enable
> it");
>      else
>        Writer.setPartialProfile();
>    }
> @@ -481,7 +481,7 @@ static void
>  mergeSampleProfile(const WeightedFileVector &Inputs, SymbolRemapper
> *Remapper,
>                     StringRef OutputFilename, ProfileFormat OutputFormat,
>                     StringRef ProfileSymbolListFile, bool
> CompressAllSections,
> -                   bool UseMD5, bool PartialProfile, FailureMode
> FailMode) {
> +                   bool UseMD5, bool GenPartialProfile, FailureMode
> FailMode) {
>    using namespace sampleprof;
>    StringMap<FunctionSamples> ProfileMap;
>    SmallVector<std::unique_ptr<sampleprof::SampleProfileReader>, 5>
> Readers;
> @@ -538,7 +538,7 @@ mergeSampleProfile(const WeightedFileVector &Inputs,
> SymbolRemapper *Remapper,
>    // Make sure Buffer lives as long as WriterList.
>    auto Buffer = getInputFileBuf(ProfileSymbolListFile);
>    handleExtBinaryWriter(*Writer, OutputFormat, Buffer.get(), WriterList,
> -                        CompressAllSections, UseMD5, PartialProfile);
> +                        CompressAllSections, UseMD5, GenPartialProfile);
>    Writer->write(ProfileMap);
>  }
>
> @@ -670,10 +670,9 @@ static int merge_main(int argc, const char *argv[]) {
>        "use-md5", cl::init(false), cl::Hidden,
>        cl::desc("Choose to use MD5 to represent string in name table (only
> "
>                 "meaningful for -extbinary)"));
> -  cl::opt<bool> PartialProfile(
> -      "partial-profile", cl::init(false), cl::Hidden,
> -      cl::desc("Set the profile to be a partial profile (only meaningful "
> -               "for -extbinary)"));
> +  cl::opt<bool> GenPartialProfile(
> +      "gen-partial-profile", cl::init(false), cl::Hidden,
> +      cl::desc("Generate a partial profile (only meaningful for
> -extbinary)"));
>
>    cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");
>
> @@ -708,7 +707,7 @@ static int merge_main(int argc, const char *argv[]) {
>    else
>      mergeSampleProfile(WeightedInputs, Remapper.get(), OutputFilename,
>                         OutputFormat, ProfileSymbolListFile,
> CompressAllSections,
> -                       UseMD5, PartialProfile, FailureMode);
> +                       UseMD5, GenPartialProfile, FailureMode);
>
>    return 0;
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200512/8fe264e2/attachment.html>


More information about the llvm-commits mailing list