From c0d040d6ae2a91286ac2164670195c2fe74ae47e Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sun, 25 Jan 2026 13:53:51 -0500 Subject: [PATCH 1/6] Migrate llvm-profdata to Opt flag parsing --- llvm/tools/llvm-profdata/CMakeLists.txt | 11 +- llvm/tools/llvm-profdata/Opts.td | 314 +++++ llvm/tools/llvm-profdata/llvm-profdata.cpp | 1092 ++++++++++------- .../llvm-project-overlay/llvm/BUILD.bazel | 13 +- .../llvm-project-overlay/llvm/driver.bzl | 1 + 5 files changed, 952 insertions(+), 479 deletions(-) create mode 100644 llvm/tools/llvm-profdata/Opts.td diff --git a/llvm/tools/llvm-profdata/CMakeLists.txt b/llvm/tools/llvm-profdata/CMakeLists.txt index e5aa858f3d39c..6d64d48ef5db3 100644 --- a/llvm/tools/llvm-profdata/CMakeLists.txt +++ b/llvm/tools/llvm-profdata/CMakeLists.txt @@ -2,14 +2,23 @@ set(LLVM_LINK_COMPONENTS Core Object ProfileData + Option Support ) +set(LLVM_TARGET_DEFINITIONS Opts.td) +tablegen(LLVM Opts.inc -gen-opt-parser-defs) +add_public_tablegen_target(ProfdataOptsTableGen) + add_llvm_tool(llvm-profdata llvm-profdata.cpp DEPENDS intrinsics_gen + ProfdataOptsTableGen + GENERATE_DRIVER ) -target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod) +if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD) + target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod) +endif() diff --git a/llvm/tools/llvm-profdata/Opts.td b/llvm/tools/llvm-profdata/Opts.td new file mode 100644 index 0000000000000..8803af9a10123 --- /dev/null +++ b/llvm/tools/llvm-profdata/Opts.td @@ -0,0 +1,314 @@ +include "llvm/Option/OptParser.td" + +def Show : SubCommand<"show", + "Takes a profile data file and displays the profiles. " + "See detailed documentation in " + "https://llvm.org/docs/CommandGuide/llvm-profdata.html" + "#profdata-show">; +def Order : SubCommand<"order", + "Reads temporal profiling traces from a profile and " + "outputs a function order that reduces page faults. " + "See detailed documentation in " + "https://llvm.org/docs/CommandGuide/llvm-profdata.html" + "#profdata-order">; +def Overlap : SubCommand<"overlap", + "Computes the overlap between two profiles. See " + "detailed documentation in " + "https://llvm.org/docs/CommandGuide/llvm-profdata.html" + "#profdata-overlap">; +def Merge : SubCommand<"merge", + "Takes several profiles and merge them together. See " + "detailed documentation in " + "https://llvm.org/docs/CommandGuide/llvm-profdata.html" + "#profdata-merge">; + +def help : Flag<["-","--"], "help", [Show, Order, Overlap, Merge]>, + HelpText<"Display this help">; +def help_hidden : Flag<["--"], "help-hidden", [Show, Order, Overlap, Merge]>, + HelpText<"Display all help, including hidden options">; +def version : Flag<["--"], "version", [Show, Order, Overlap, Merge]>, + HelpText<"Display the version">; + +def output : JoinedOrSeparate<["-","--"], "output", + [Show, Order, Overlap, Merge]>, + MetaVarName<"">, + HelpText<"Output file">; +def : JoinedOrSeparate<["-"], "o", [Show, Order, Overlap, Merge]>, + Alias, HelpText<"Alias for --output">; + +def instr : Flag<["-","--"], "instr", [Show, Overlap, Merge]>, + HelpText<"Instrumentation profile (default)">; +def sample : Flag<["-","--"], "sample", [Show, Overlap, Merge]>, + HelpText<"Sample profile">; +def memory : Flag<["-","--"], "memory", [Show]>, + HelpText<"MemProf memory access profile">; + +def max_debug_info_correlation_warnings + : JoinedOrSeparate<["-","--"], "max-debug-info-correlation-warnings", + [Show, Merge]>, + HelpText<"Maximum number of warnings to emit when correlating profile " + "from debug info (0 = no limit)">, + MetaVarName<"">; +def profiled_binary + : JoinedOrSeparate<["-","--"], "profiled-binary", [Show, Merge]>, + HelpText<"Path to binary from which the profile was collected.">, + MetaVarName<"">; +def debug_info + : JoinedOrSeparate<["-","--"], "debug-info", [Show, Merge]>, + HelpText<"For show, read and extract profile metadata from debug info. " + "For merge, correlate the raw profile using the provided " + "debug info.">, + MetaVarName<"">; +def binary_file + : JoinedOrSeparate<["-","--"], "binary-file", [Merge]>, + HelpText<"Use the provided unstripped binary to correlate the raw " + "profile.">, + MetaVarName<"">; +def debug_file_directory + : JoinedOrSeparate<["-","--"], "debug-file-directory", + [Show, Order, Overlap, Merge]>, + HelpText<"Directories to search for object files by build ID">, + MetaVarName<"">; +def debuginfod : Flag<["-","--"], "debuginfod", [Merge]>, + HelpText<"Enable debuginfod">, Flags<[HelpHidden]>; +def correlate : JoinedOrSeparate<["-","--"], "correlate", + [Show, Order, Overlap, Merge]>, + HelpText<"Use debug-info or binary correlation to correlate " + "profiles with build id fetcher">, + MetaVarName<"">; +def function : JoinedOrSeparate<["-","--"], "function", + [Show, Overlap, Merge]>, + HelpText<"Only functions matching the filter are shown or " + "merged.">, + MetaVarName<"">; + +def weighted_input + : JoinedOrSeparate<["-","--"], "weighted-input", [Merge]>, + HelpText<",">, MetaVarName<",">; +def binary : Flag<["-","--"], "binary", [Merge]>, + HelpText<"Binary encoding">; +def extbinary : Flag<["-","--"], "extbinary", [Merge]>, + HelpText<"Extensible binary encoding (default)">; +def text : Flag<["-","--"], "text", [Show, Merge]>, + HelpText<"Text output format">; +def gcc : Flag<["-","--"], "gcc", [Merge]>, + HelpText<"GCC encoding (only meaningful for -sample)">; +def input_files + : JoinedOrSeparate<["-","--"], "input-files", [Merge]>, + HelpText<"Path to file containing newline-separated " + "[,] entries">, + MetaVarName<"">; +def : JoinedOrSeparate<["-"], "f", [Merge]>, Alias, + HelpText<"Alias for --input-files">; +def dump_input_file_list : Flag<["-","--"], "dump-input-file-list", [Merge]>, + HelpText<"Dump the list of input files and their " + "weights, then exit">, + Flags<[HelpHidden]>; +def remapping_file + : JoinedOrSeparate<["-","--"], "remapping-file", [Merge]>, + HelpText<"Symbol remapping file">, MetaVarName<"">; +def : JoinedOrSeparate<["-"], "r", [Merge]>, Alias, + HelpText<"Alias for --remapping-file">; +def use_md5 : Flag<["-","--"], "use-md5", [Merge]>, + HelpText<"Use MD5 to represent strings in the name table " + "(only meaningful for -extbinary)">, + Flags<[HelpHidden]>; +def compress_all_sections + : Flag<["-","--"], "compress-all-sections", [Merge]>, + HelpText<"Compress all sections when writing the profile (only " + "meaningful for -extbinary)">, + Flags<[HelpHidden]>; +def sample_merge_cold_context + : Flag<["-","--"], "sample-merge-cold-context", [Merge]>, + HelpText<"Merge context sample profiles whose count is below cold " + "threshold">, + Flags<[HelpHidden]>; +def sample_trim_cold_context + : Flag<["-","--"], "sample-trim-cold-context", [Merge]>, + HelpText<"Trim context sample profiles whose count is below cold " + "threshold">, + Flags<[HelpHidden]>; +def sample_frame_depth_for_cold_context + : JoinedOrSeparate<["-","--"], "sample-frame-depth-for-cold-context", + [Merge]>, + HelpText<"Keep the last K frames while merging cold profile. 1 means " + "the context-less base profile">, + Flags<[HelpHidden]>, MetaVarName<"">; +def output_size_limit + : JoinedOrSeparate<["-","--"], "output-size-limit", [Merge]>, + HelpText<"Trim cold functions until profile size is below specified " + "limit in bytes">, + Flags<[HelpHidden]>, MetaVarName<"">; +def gen_partial_profile + : Flag<["-","--"], "gen-partial-profile", [Merge]>, + HelpText<"Generate a partial profile (only meaningful for -extbinary)">, + Flags<[HelpHidden]>; +def split_layout : Flag<["-","--"], "split-layout", [Merge]>, + HelpText<"Split the profile into sections with and without " + "inlined functions (only meaningful for " + "-extbinary)">, + Flags<[HelpHidden]>; +def supplement_instr_with_sample + : JoinedOrSeparate<["-","--"], "supplement-instr-with-sample", [Merge]>, + HelpText<"Supplement an instr profile with a sample profile. Output " + "will be in instr format.">, + Flags<[HelpHidden]>, MetaVarName<"">; +def zero_counter_threshold + : JoinedOrSeparate<["-","--"], "zero-counter-threshold", [Merge]>, + HelpText<"Ratio of zero counters required to drop a function when " + "supplementing instr profiles">, + Flags<[HelpHidden]>, MetaVarName<"">; +def suppl_min_size_threshold + : JoinedOrSeparate<["-","--"], "suppl-min-size-threshold", [Merge]>, + HelpText<"Assume functions smaller than this threshold can be inlined " + "and will not be adjusted based on sample profile.">, + Flags<[HelpHidden]>, MetaVarName<"">; +def instr_prof_cold_threshold + : JoinedOrSeparate<["-","--"], "instr-prof-cold-threshold", [Merge]>, + HelpText<"User specified cold threshold for instr profile to override " + "the cold threshold from profile summary.">, + Flags<[HelpHidden]>, MetaVarName<"">; +def temporal_profile_trace_reservoir_size + : JoinedOrSeparate<["-","--"], "temporal-profile-trace-reservoir-size", + [Merge]>, + HelpText<"Maximum number of stored temporal profile traces (default: " + "100)">, + MetaVarName<"">; +def temporal_profile_max_trace_length + : JoinedOrSeparate<["-","--"], "temporal-profile-max-trace-length", + [Merge]>, + HelpText<"Maximum length of a single temporal profile trace " + "(default: 10000)">, + MetaVarName<"">; +def no_function : JoinedOrSeparate<["-","--"], "no-function", [Merge]>, + HelpText<"Exclude functions matching the filter from the " + "output.">, + MetaVarName<"">; +def failure_mode + : JoinedOrSeparate<["-","--"], "failure-mode", [Merge]>, + HelpText<"Failure mode: warn, any, or all">, + MetaVarName<"">; +def sparse : Flag<["-","--"], "sparse", [Merge]>, + HelpText<"Generate a sparse profile (only meaningful for -instr)">; +def num_threads : JoinedOrSeparate<["-","--"], "num-threads", [Merge]>, + HelpText<"Number of merge threads to use (default: autodetect)">, + MetaVarName<"">; +def : JoinedOrSeparate<["-"], "j", [Merge]>, Alias, + HelpText<"Alias for --num-threads">; +def prof_sym_list + : JoinedOrSeparate<["-","--"], "prof-sym-list", [Merge]>, + HelpText<"Path to file containing the list of function symbols used to " + "populate profile symbol list">, + MetaVarName<"">; +def convert_sample_profile_layout + : JoinedOrSeparate<["-","--"], "convert-sample-profile-layout", [Merge]>, + HelpText<"Convert the generated profile to a new layout: nest or flat">, + MetaVarName<"">; +def drop_profile_symbol_list + : Flag<["-","--"], "drop-profile-symbol-list", [Merge]>, + HelpText<"Drop the profile symbol list when merging AutoFDO profiles " + "(only meaningful for -sample)">, + Flags<[HelpHidden]>; +def keep_vtable_symbols + : Flag<["-","--"], "keep-vtable-symbols", [Merge]>, + HelpText<"Keep the vtable symbols in indexed profiles">, + Flags<[HelpHidden]>; +def write_prev_version + : Flag<["-","--"], "write-prev-version", [Merge]>, + HelpText<"Write the previous version of indexed format for forward " + "compatibility.">, + Flags<[HelpHidden]>; +def memprof_version + : JoinedOrSeparate<["-","--"], "memprof-version", [Merge]>, + HelpText<"Specify the version of the memprof format to use (2, 3, or 4)">, + Flags<[HelpHidden]>, MetaVarName<"">; +def memprof_full_schema + : Flag<["-","--"], "memprof-full-schema", [Merge]>, + HelpText<"Use the full schema for serialization">, + Flags<[HelpHidden]>; +def memprof_random_hotness + : Flag<["-","--"], "memprof-random-hotness", [Merge]>, + HelpText<"Generate random hotness values">, + Flags<[HelpHidden]>; +def memprof_random_hotness_seed + : JoinedOrSeparate<["-","--"], "memprof-random-hotness-seed", [Merge]>, + HelpText<"Random hotness seed to use (0 to generate new seed)">, + Flags<[HelpHidden]>, MetaVarName<"">; + +def similarity_cutoff + : JoinedOrSeparate<["-","--"], "similarity-cutoff", [Overlap]>, + HelpText<"List overlapped functions with similarities below the cutoff " + "(percentage times 10000).">, + MetaVarName<"">; +def cs : Flag<["-","--"], "cs", [Overlap]>, + HelpText<"For context sensitive PGO counts. Does not work with " + "CSSPGO.">; +def value_cutoff + : JoinedOrSeparate<["-","--"], "value-cutoff", [Show, Overlap]>, + HelpText<"Cutoff value used for filtering. Meaning depends on subcommand">, + MetaVarName<"">; + +def counts : Flag<["-","--"], "counts", [Show]>, + HelpText<"Show counter values for shown functions">; +def show_format + : JoinedOrSeparate<["-","--"], "show-format", [Show]>, + HelpText<"Emit output in the selected format: text, json, or yaml">, + MetaVarName<"">; +def json : Flag<["-","--"], "json", [Show]>, + HelpText<"Show sample profile data in JSON format " + "(deprecated, use --show-format=json)">; +def ic_targets : Flag<["-","--"], "ic-targets", [Show]>, + HelpText<"Show indirect call site target values">; +def show_vtables : Flag<["-","--"], "show-vtables", [Show]>, + HelpText<"Show vtable names for shown functions">; +def memop_sizes : Flag<["-","--"], "memop-sizes", [Show]>, + HelpText<"Show profiled sizes of memory intrinsic calls">; +def detailed_summary : Flag<["-","--"], "detailed-summary", [Show]>, + HelpText<"Show detailed profile summary">; +def detailed_summary_cutoffs + : CommaJoined<["-","--"], "detailed-summary-cutoffs", [Show]>, + HelpText<"Cutoff percentages (times 10000) for generating detailed " + "summary">, + MetaVarName<"">; +def hot_func_list : Flag<["-","--"], "hot-func-list", [Show]>, + HelpText<"Show profile summary of a list of hot functions">; +def all_functions : Flag<["-","--"], "all-functions", [Show]>, + HelpText<"Details for each and every function">; +def showcs : Flag<["-","--"], "showcs", [Show]>, + HelpText<"Show context sensitive counts">; +def topn : JoinedOrSeparate<["-","--"], "topn", [Show]>, + HelpText<"Show the list of functions with the largest internal counts">, + MetaVarName<"">; +def list_below_cutoff + : Flag<["-","--"], "list-below-cutoff", [Show]>, + HelpText<"Only output names of functions whose max count values are " + "below the cutoff value">; +def show_prof_sym_list + : Flag<["-","--"], "show-prof-sym-list", [Show]>, + HelpText<"Show profile symbol list if it exists in the profile.">; +def show_sec_info_only + : Flag<["-","--"], "show-sec-info-only", [Show]>, + HelpText<"Show the information of each section in the sample profile " + "(extbinary sample profiles only)">; +def binary_ids : Flag<["-","--"], "binary-ids", [Show]>, + HelpText<"Show binary ids in the profile.">; +def temporal_profile_traces + : Flag<["-","--"], "temporal-profile-traces", [Show]>, + HelpText<"Show temporal profile traces in the profile.">; +def covered : Flag<["-","--"], "covered", [Show]>, + HelpText<"Show only the functions that have been executed.">; +def profile_version : Flag<["-","--"], "profile-version", [Show]>, + HelpText<"Show profile version.">; + +def num_test_traces + : JoinedOrSeparate<["-","--"], "num-test-traces", [Order]>, + HelpText<"Keep aside the last traces when computing " + "function order to evaluate that order">, + MetaVarName<"">; + +def fs_discriminator_pass + : JoinedOrSeparate<["-","--"], "fs-discriminator-pass", + [Show, Overlap, Merge]>, + HelpText<"Zero out the discriminator bits for the FS discriminator " + "pass beyond this value.">, + Flags<[HelpHidden]>, MetaVarName<"">; diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 74c4732ca129a..4c8c7519df9ca 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -10,13 +10,20 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSwitch.h" #include "llvm/Debuginfod/HTTPClient.h" #include "llvm/IR/LLVMContext.h" #include "llvm/Object/Binary.h" +#include "llvm/Option/Arg.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" +#include "llvm/Option/Option.h" #include "llvm/ProfileData/DataAccessProf.h" #include "llvm/ProfileData/InstrProfCorrelator.h" #include "llvm/ProfileData/InstrProfReader.h" @@ -35,11 +42,12 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" -#include "llvm/Support/InitLLVM.h" +#include "llvm/Support/LLVMDriver.h" #include "llvm/Support/MD5.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/Regex.h" +#include "llvm/Support/StringSaver.h" #include "llvm/Support/ThreadPool.h" #include "llvm/Support/Threading.h" #include "llvm/Support/VirtualFileSystem.h" @@ -47,35 +55,15 @@ #include "llvm/Support/raw_ostream.h" #include #include +#include #include +#include "Opts.inc" + using namespace llvm; +using namespace llvm::opt; using ProfCorrelatorKind = InstrProfCorrelator::ProfCorrelatorKind; -// https://llvm.org/docs/CommandGuide/llvm-profdata.html has documentations -// on each subcommand. -cl::SubCommand ShowSubcommand( - "show", - "Takes a profile data file and displays the profiles. See detailed " - "documentation in " - "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-show"); -cl::SubCommand OrderSubcommand( - "order", - "Reads temporal profiling traces from a profile and outputs a function " - "order that reduces the number of page faults for those traces. See " - "detailed documentation in " - "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-order"); -cl::SubCommand OverlapSubcommand( - "overlap", - "Computes and displays the overlap between two profiles. See detailed " - "documentation in " - "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-overlap"); -cl::SubCommand MergeSubcommand( - "merge", - "Takes several profiles and merge them together. See detailed " - "documentation in " - "https://llvm.org/docs/CommandGuide/llvm-profdata.html#profdata-merge"); - namespace { enum ProfileKinds { instr, sample, memory }; enum FailureMode { warnOnly, failIfAnyAreInvalid, failIfAllAreInvalid }; @@ -90,408 +78,132 @@ enum ProfileFormat { }; enum class ShowFormat { Text, Json, Yaml }; -} // namespace -// Common options. -cl::opt OutputFilename("output", cl::value_desc("output"), - cl::init("-"), cl::desc("Output file"), - cl::sub(ShowSubcommand), - cl::sub(OrderSubcommand), - cl::sub(OverlapSubcommand), - cl::sub(MergeSubcommand)); -// NOTE: cl::alias must not have cl::sub(), since aliased option's cl::sub() -// will be used. llvm::cl::alias::done() method asserts this condition. -static cl::alias OutputFilenameA("o", cl::desc("Alias for --output"), - cl::aliasopt(OutputFilename)); - -// Options common to at least two commands. -static cl::opt ProfileKind( - cl::desc("Profile kind:"), cl::sub(MergeSubcommand), - cl::sub(OverlapSubcommand), cl::init(instr), - cl::values(clEnumVal(instr, "Instrumentation profile (default)"), - clEnumVal(sample, "Sample profile"))); -static cl::opt Filename(cl::Positional, - cl::desc(""), - cl::sub(ShowSubcommand), - cl::sub(OrderSubcommand)); -static cl::opt MaxDbgCorrelationWarnings( - "max-debug-info-correlation-warnings", - cl::desc("The maximum number of warnings to emit when correlating " - "profile from debug info (0 = no limit)"), - cl::sub(MergeSubcommand), cl::sub(ShowSubcommand), cl::init(5)); -static cl::opt ProfiledBinary( - "profiled-binary", cl::init(""), - cl::desc("Path to binary from which the profile was collected."), - cl::sub(ShowSubcommand), cl::sub(MergeSubcommand)); -static cl::opt DebugInfoFilename( - "debug-info", cl::init(""), - cl::desc( - "For show, read and extract profile metadata from debug info and show " - "the functions it found. For merge, use the provided debug info to " - "correlate the raw profile."), - cl::sub(ShowSubcommand), cl::sub(MergeSubcommand)); -static cl::opt - BinaryFilename("binary-file", cl::init(""), - cl::desc("For merge, use the provided unstripped binary to " - "correlate the raw profile."), - cl::sub(MergeSubcommand)); -static cl::list DebugFileDirectory( - "debug-file-directory", - cl::desc("Directories to search for object files by build ID")); -static cl::opt DebugInfod("debuginfod", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Enable debuginfod")); -static cl::opt BIDFetcherProfileCorrelate( - "correlate", - cl::desc("Use debug-info or binary correlation to correlate profiles with " - "build id fetcher"), - cl::init(InstrProfCorrelator::NONE), - cl::values(clEnumValN(InstrProfCorrelator::NONE, "", - "No profile correlation"), - clEnumValN(InstrProfCorrelator::DEBUG_INFO, "debug-info", - "Use debug info to correlate"), - clEnumValN(InstrProfCorrelator::BINARY, "binary", - "Use binary to correlate"))); -static cl::opt FuncNameFilter( - "function", - cl::desc("Only functions matching the filter are shown in the output. For " - "overlapping CSSPGO, this takes a function name with calling " - "context."), - cl::sub(ShowSubcommand), cl::sub(OverlapSubcommand), - cl::sub(MergeSubcommand)); - -// TODO: Consider creating a template class (e.g., MergeOption, ShowOption) to -// factor out the common cl::sub in cl::opt constructor for subcommand-specific -// options. - -// Options specific to merge subcommand. -static cl::list InputFilenames(cl::Positional, - cl::sub(MergeSubcommand), - cl::desc("")); -static cl::list - WeightedInputFilenames("weighted-input", cl::sub(MergeSubcommand), - cl::desc(",")); -static cl::opt OutputFormat( - cl::desc("Format of output profile"), cl::sub(MergeSubcommand), - cl::init(PF_Ext_Binary), - cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding"), - clEnumValN(PF_Ext_Binary, "extbinary", - "Extensible binary encoding " - "(default)"), - clEnumValN(PF_Text, "text", "Text encoding"), - clEnumValN(PF_GCC, "gcc", - "GCC encoding (only meaningful for -sample)"))); -static cl::opt - InputFilenamesFile("input-files", cl::init(""), cl::sub(MergeSubcommand), - cl::desc("Path to file containing newline-separated " - "[,] entries")); -static cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"), - cl::aliasopt(InputFilenamesFile)); -static cl::opt DumpInputFileList( - "dump-input-file-list", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Dump the list of input files and their weights, then exit")); -static cl::opt RemappingFile("remapping-file", - cl::value_desc("file"), - cl::sub(MergeSubcommand), - cl::desc("Symbol remapping file")); -static cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"), - cl::aliasopt(RemappingFile)); -static cl::opt - UseMD5("use-md5", cl::init(false), cl::Hidden, - cl::desc("Choose to use MD5 to represent string in name table (only " - "meaningful for -extbinary)"), - cl::sub(MergeSubcommand)); -static cl::opt CompressAllSections( - "compress-all-sections", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Compress all sections when writing the profile (only " - "meaningful for -extbinary)")); -static cl::opt SampleMergeColdContext( - "sample-merge-cold-context", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc( - "Merge context sample profiles whose count is below cold threshold")); -static cl::opt SampleTrimColdContext( - "sample-trim-cold-context", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc( - "Trim context sample profiles whose count is below cold threshold")); -static cl::opt SampleColdContextFrameDepth( - "sample-frame-depth-for-cold-context", cl::init(1), - cl::sub(MergeSubcommand), - cl::desc("Keep the last K frames while merging cold profile. 1 means the " - "context-less base profile")); -static cl::opt OutputSizeLimit( - "output-size-limit", cl::init(0), cl::Hidden, cl::sub(MergeSubcommand), - cl::desc("Trim cold functions until profile size is below specified " - "limit in bytes. This uses a heursitic and functions may be " - "excessively trimmed")); -static cl::opt GenPartialProfile( - "gen-partial-profile", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Generate a partial profile (only meaningful for -extbinary)")); -static cl::opt SplitLayout( - "split-layout", cl::init(false), cl::Hidden, cl::sub(MergeSubcommand), - cl::desc("Split the profile to two sections with one containing sample " - "profiles with inlined functions and the other without (only " - "meaningful for -extbinary)")); -static cl::opt SupplInstrWithSample( - "supplement-instr-with-sample", cl::init(""), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Supplement an instr profile with sample profile, to correct " - "the profile unrepresentativeness issue. The sample " - "profile is the input of the flag. Output will be in instr " - "format (The flag only works with -instr)")); -static cl::opt ZeroCounterThreshold( - "zero-counter-threshold", cl::init(0.7), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("For the function which is cold in instr profile but hot in " - "sample profile, if the ratio of the number of zero counters " - "divided by the total number of counters is above the " - "threshold, the profile of the function will be regarded as " - "being harmful for performance and will be dropped.")); -static cl::opt SupplMinSizeThreshold( - "suppl-min-size-threshold", cl::init(10), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("If the size of a function is smaller than the threshold, " - "assume it can be inlined by PGO early inliner and it won't " - "be adjusted based on sample profile.")); -static cl::opt InstrProfColdThreshold( - "instr-prof-cold-threshold", cl::init(0), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("User specified cold threshold for instr profile which will " - "override the cold threshold got from profile summary. ")); -// WARNING: This reservoir size value is propagated to any input indexed -// profiles for simplicity. Changing this value between invocations could -// result in sample bias. -static cl::opt TemporalProfTraceReservoirSize( - "temporal-profile-trace-reservoir-size", cl::init(100), - cl::sub(MergeSubcommand), - cl::desc("The maximum number of stored temporal profile traces (default: " - "100)")); -static cl::opt TemporalProfMaxTraceLength( - "temporal-profile-max-trace-length", cl::init(10000), - cl::sub(MergeSubcommand), - cl::desc("The maximum length of a single temporal profile trace " - "(default: 10000)")); -static cl::opt FuncNameNegativeFilter( - "no-function", cl::init(""), cl::sub(MergeSubcommand), - cl::desc("Exclude functions matching the filter from the output.")); - -static cl::opt - FailMode("failure-mode", cl::init(failIfAnyAreInvalid), - cl::desc("Failure mode:"), cl::sub(MergeSubcommand), - cl::values(clEnumValN(warnOnly, "warn", - "Do not fail and just print warnings."), - clEnumValN(failIfAnyAreInvalid, "any", - "Fail if any profile is invalid."), - clEnumValN(failIfAllAreInvalid, "all", - "Fail only if all profiles are invalid."))); - -static cl::opt OutputSparse( - "sparse", cl::init(false), cl::sub(MergeSubcommand), - cl::desc("Generate a sparse profile (only meaningful for -instr)")); -static cl::opt NumThreads( - "num-threads", cl::init(0), cl::sub(MergeSubcommand), - cl::desc("Number of merge threads to use (default: autodetect)")); -static cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"), - cl::aliasopt(NumThreads)); - -static cl::opt ProfileSymbolListFile( - "prof-sym-list", cl::init(""), cl::sub(MergeSubcommand), - cl::desc("Path to file containing the list of function symbols " - "used to populate profile symbol list")); - -static cl::opt ProfileLayout( - "convert-sample-profile-layout", - cl::desc("Convert the generated profile to a profile with a new layout"), - cl::sub(MergeSubcommand), cl::init(SPL_None), - cl::values( - clEnumValN(SPL_Nest, "nest", - "Nested profile, the input should be CS flat profile"), - clEnumValN(SPL_Flat, "flat", - "Profile with nested inlinee flatten out"))); - -static cl::opt DropProfileSymbolList( - "drop-profile-symbol-list", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Drop the profile symbol list when merging AutoFDO profiles " - "(only meaningful for -sample)")); - -static cl::opt KeepVTableSymbols( - "keep-vtable-symbols", cl::init(false), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("If true, keep the vtable symbols in indexed profiles")); - -// 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. -static cl::opt DoWritePrevVersion( - "write-prev-version", cl::init(false), cl::Hidden, - cl::desc("Write the previous version of indexed format, to enable " - "some forward compatibility.")); - -static cl::opt MemProfVersionRequested( - "memprof-version", cl::Hidden, cl::sub(MergeSubcommand), - cl::desc("Specify the version of the memprof format to use"), - cl::init(memprof::Version3), - cl::values(clEnumValN(memprof::Version2, "2", "version 2"), - clEnumValN(memprof::Version3, "3", "version 3"), - clEnumValN(memprof::Version4, "4", "version 4"))); - -static cl::opt MemProfFullSchema( - "memprof-full-schema", cl::Hidden, cl::sub(MergeSubcommand), - cl::desc("Use the full schema for serialization"), cl::init(false)); - -static cl::opt - MemprofGenerateRandomHotness("memprof-random-hotness", cl::init(false), - cl::Hidden, cl::sub(MergeSubcommand), - cl::desc("Generate random hotness values")); -static cl::opt MemprofGenerateRandomHotnessSeed( - "memprof-random-hotness-seed", cl::init(0), cl::Hidden, - cl::sub(MergeSubcommand), - cl::desc("Random hotness seed to use (0 to generate new seed)")); - -// Options specific to overlap subcommand. -static cl::opt BaseFilename(cl::Positional, cl::Required, - cl::desc(""), - cl::sub(OverlapSubcommand)); -static cl::opt TestFilename(cl::Positional, cl::Required, - cl::desc(""), - cl::sub(OverlapSubcommand)); - -static cl::opt SimilarityCutoff( - "similarity-cutoff", cl::init(0), - cl::desc("For sample profiles, list function names (with calling context " - "for csspgo) for overlapped functions " - "with similarities below the cutoff (percentage times 10000)."), - cl::sub(OverlapSubcommand)); - -static cl::opt IsCS( - "cs", cl::init(false), - cl::desc("For context sensitive PGO counts. Does not work with CSSPGO."), - cl::sub(OverlapSubcommand)); - -static cl::opt OverlapValueCutoff( - "value-cutoff", cl::init(-1), - cl::desc( - "Function level overlap information for every function (with calling " - "context for csspgo) in test " - "profile with max count value greater than the parameter value"), - cl::sub(OverlapSubcommand)); - -// Options specific to show subcommand. -static cl::opt - ShowCounts("counts", cl::init(false), - cl::desc("Show counter values for shown functions"), - cl::sub(ShowSubcommand)); -static cl::opt - SFormat("show-format", cl::init(ShowFormat::Text), - cl::desc("Emit output in the selected format if supported"), - cl::sub(ShowSubcommand), - cl::values(clEnumValN(ShowFormat::Text, "text", - "emit normal text output (default)"), - clEnumValN(ShowFormat::Json, "json", "emit JSON"), - clEnumValN(ShowFormat::Yaml, "yaml", "emit YAML"))); -// TODO: Consider replacing this with `--show-format=text-encoding`. -static cl::opt - TextFormat("text", cl::init(false), - cl::desc("Show instr profile data in text dump format"), - cl::sub(ShowSubcommand)); -static cl::opt - JsonFormat("json", - cl::desc("Show sample profile data in the JSON format " - "(deprecated, please use --show-format=json)"), - cl::sub(ShowSubcommand)); -static cl::opt ShowIndirectCallTargets( - "ic-targets", cl::init(false), - cl::desc("Show indirect call site target values for shown functions"), - cl::sub(ShowSubcommand)); -static cl::opt - ShowVTables("show-vtables", cl::init(false), - cl::desc("Show vtable names for shown functions"), - cl::sub(ShowSubcommand)); -static cl::opt ShowMemOPSizes( - "memop-sizes", cl::init(false), - cl::desc("Show the profiled sizes of the memory intrinsic calls " - "for shown functions"), - cl::sub(ShowSubcommand)); -static cl::opt - ShowDetailedSummary("detailed-summary", cl::init(false), - cl::desc("Show detailed profile summary"), - cl::sub(ShowSubcommand)); -static cl::list DetailedSummaryCutoffs( - cl::CommaSeparated, "detailed-summary-cutoffs", - cl::desc( - "Cutoff percentages (times 10000) for generating detailed summary"), - cl::value_desc("800000,901000,999999"), cl::sub(ShowSubcommand)); -static cl::opt - ShowHotFuncList("hot-func-list", cl::init(false), - cl::desc("Show profile summary of a list of hot functions"), - cl::sub(ShowSubcommand)); -static cl::opt - ShowAllFunctions("all-functions", cl::init(false), - cl::desc("Details for each and every function"), - cl::sub(ShowSubcommand)); -static cl::opt ShowCS("showcs", cl::init(false), - cl::desc("Show context sensitive counts"), - cl::sub(ShowSubcommand)); -static cl::opt ShowProfileKind( - cl::desc("Profile kind supported by show:"), cl::sub(ShowSubcommand), - cl::init(instr), - cl::values(clEnumVal(instr, "Instrumentation profile (default)"), - clEnumVal(sample, "Sample profile"), - clEnumVal(memory, "MemProf memory access profile"))); -static cl::opt TopNFunctions( - "topn", cl::init(0), - cl::desc("Show the list of functions with the largest internal counts"), - cl::sub(ShowSubcommand)); -static cl::opt ShowValueCutoff( - "value-cutoff", cl::init(0), - cl::desc("Set the count value cutoff. Functions with the maximum count " - "less than this value will not be printed out. (Default is 0)"), - cl::sub(ShowSubcommand)); -static cl::opt OnlyListBelow( - "list-below-cutoff", cl::init(false), - cl::desc("Only output names of functions whose max count values are " - "below the cutoff value"), - cl::sub(ShowSubcommand)); -static cl::opt ShowProfileSymbolList( - "show-prof-sym-list", cl::init(false), - cl::desc("Show profile symbol list if it exists in the profile. "), - cl::sub(ShowSubcommand)); -static cl::opt ShowSectionInfoOnly( - "show-sec-info-only", cl::init(false), - cl::desc("Show the information of each section in the sample profile. " - "The flag is only usable when the sample profile is in " - "extbinary format"), - cl::sub(ShowSubcommand)); -static cl::opt ShowBinaryIds("binary-ids", cl::init(false), - cl::desc("Show binary ids in the profile. "), - cl::sub(ShowSubcommand)); -static cl::opt ShowTemporalProfTraces( - "temporal-profile-traces", - cl::desc("Show temporal profile traces in the profile."), - cl::sub(ShowSubcommand)); - -static cl::opt - ShowCovered("covered", cl::init(false), - cl::desc("Show only the functions that have been executed."), - cl::sub(ShowSubcommand)); - -static cl::opt ShowProfileVersion("profile-version", cl::init(false), - cl::desc("Show profile version. "), - cl::sub(ShowSubcommand)); - -// Options specific to order subcommand. -static cl::opt - NumTestTraces("num-test-traces", cl::init(0), - cl::desc("Keep aside the last traces in " - "the profile when computing the function order and " - "instead use them to evaluate that order"), - cl::sub(OrderSubcommand)); +enum ID { + OPT_INVALID = 0, +#define OPTION(PREFIXES, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, \ + VISIBILITY, PARAM, HELPTEXT, HELPTEXTSFORVARIANTS, METAVAR, \ + VALUES, SUBCOMMANDIDS_OFFSET) \ + OPT_##ID, +#include "Opts.inc" +#undef OPTION +}; + +#define OPTTABLE_STR_TABLE_CODE +#include "Opts.inc" +#undef OPTTABLE_STR_TABLE_CODE + +#define OPTTABLE_PREFIXES_TABLE_CODE +#include "Opts.inc" +#undef OPTTABLE_PREFIXES_TABLE_CODE + +#define OPTTABLE_SUBCOMMAND_IDS_TABLE_CODE +#include "Opts.inc" +#undef OPTTABLE_SUBCOMMAND_IDS_TABLE_CODE + +#define OPTTABLE_SUBCOMMANDS_CODE +#include "Opts.inc" +#undef OPTTABLE_SUBCOMMANDS_CODE + +static constexpr opt::OptTable::Info InfoTable[] = { +#define OPTION(...) LLVM_CONSTRUCT_OPT_INFO(__VA_ARGS__), +#include "Opts.inc" +#undef OPTION +}; + +class ProfdataOptTable : public opt::GenericOptTable { +public: + ProfdataOptTable() + : opt::GenericOptTable(OptionStrTable, OptionPrefixesTable, InfoTable, + /*IgnoreCase=*/false, OptionSubCommands, + OptionSubCommandIDsTable) { + setGroupedShortOptions(true); + setDashDashParsing(true); + } +}; + +static std::string ProgramName; + +static std::string OutputFilename = "-"; +static ProfileKinds ProfileKind = instr; +static std::string Filename; +static unsigned MaxDbgCorrelationWarnings = 5; +static std::string ProfiledBinary; +static std::string DebugInfoFilename; +static std::string BinaryFilename; +static std::vector DebugFileDirectory; +static bool DebugInfod = false; +static ProfCorrelatorKind BIDFetcherProfileCorrelate = + InstrProfCorrelator::NONE; +static std::string FuncNameFilter; + +static std::vector InputFilenames; +static std::vector WeightedInputFilenames; +static ProfileFormat OutputFormat = PF_Ext_Binary; +static std::string InputFilenamesFile; +static bool DumpInputFileList = false; +static std::string RemappingFile; +static bool UseMD5 = false; +static bool CompressAllSections = false; +static bool SampleMergeColdContext = false; +static bool SampleTrimColdContext = false; +static uint32_t SampleColdContextFrameDepth = 1; +static size_t OutputSizeLimit = 0; +static bool GenPartialProfile = false; +static bool SplitLayout = false; +static std::string SupplInstrWithSample; +static float ZeroCounterThreshold = 0.7f; +static unsigned SupplMinSizeThreshold = 10; +static unsigned InstrProfColdThreshold = 0; +static uint64_t TemporalProfTraceReservoirSize = 100; +static uint64_t TemporalProfMaxTraceLength = 10000; +static std::string FuncNameNegativeFilter; +static FailureMode FailMode = failIfAnyAreInvalid; +static bool OutputSparse = false; +static unsigned NumThreads = 0; +static std::string ProfileSymbolListFile; +static SampleProfileLayout ProfileLayout = SPL_None; +static bool DropProfileSymbolList = false; +static bool KeepVTableSymbols = false; +static bool DoWritePrevVersion = false; +static memprof::IndexedVersion MemProfVersionRequested = memprof::Version3; +static bool MemProfFullSchema = false; +static bool MemprofGenerateRandomHotness = false; +static unsigned MemprofGenerateRandomHotnessSeed = 0; + +static std::string BaseFilename; +static std::string TestFilename; +static unsigned long long SimilarityCutoff = 0; +static bool IsCS = false; +static unsigned long long OverlapValueCutoff = + std::numeric_limits::max(); + +static bool ShowCounts = false; +static ShowFormat SFormat = ShowFormat::Text; +static bool TextFormat = false; +static bool JsonFormat = false; +static bool ShowIndirectCallTargets = false; +static bool ShowVTables = false; +static bool ShowMemOPSizes = false; +static bool ShowDetailedSummary = false; +static std::vector DetailedSummaryCutoffs; +static bool ShowHotFuncList = false; +static bool ShowAllFunctions = false; +static bool ShowCS = false; +static ProfileKinds ShowProfileKind = instr; +static uint32_t TopNFunctions = 0; +static uint32_t ShowValueCutoff = 0; +static bool OnlyListBelow = false; +static bool ShowProfileSymbolList = false; +static bool ShowSectionInfoOnly = false; +static bool ShowBinaryIds = false; +static bool ShowTemporalProfTraces = false; +static bool ShowCovered = false; +static bool ShowProfileVersion = false; + +static unsigned NumTestTraces = 0; +static FSDiscriminatorPass FSDiscriminatorPassOption = PassLast; +} // namespace // We use this string to indicate that there are // multiple static functions map to the same name. @@ -637,7 +349,7 @@ class SymbolRemapper { return New.empty() ? Name : FunctionId(New); } }; -} +} // namespace struct WeightedFile { std::string Filename; @@ -897,13 +609,11 @@ getFuncName(const StringMap::value_type &Val) { return Val.first(); } -static std::string -getFuncName(const SampleProfileMap::value_type &Val) { +static std::string getFuncName(const SampleProfileMap::value_type &Val) { return Val.second.getContext().toString(); } -template -static void filterFunctions(T &ProfileMap) { +template static void filterFunctions(T &ProfileMap) { bool hasFilter = !FuncNameFilter.empty(); bool hasNegativeFilter = !FuncNameNegativeFilter.empty(); if (!hasFilter && !hasNegativeFilter) @@ -973,8 +683,8 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs, SymbolRemapper *Remapper, int MaxDbgCorrelationWarnings, const StringRef ProfiledBinary) { - const uint64_t TraceReservoirSize = TemporalProfTraceReservoirSize.getValue(); - const uint64_t MaxTraceLength = TemporalProfMaxTraceLength.getValue(); + const uint64_t TraceReservoirSize = TemporalProfTraceReservoirSize; + const uint64_t MaxTraceLength = TemporalProfMaxTraceLength; if (OutputFormat == PF_Compact_Binary) exitWithError("Compact Binary is deprecated"); if (OutputFormat != PF_Binary && OutputFormat != PF_Ext_Binary && @@ -1171,21 +881,8 @@ const uint64_t HotPercentileIdx = 11; using sampleprof::FSDiscriminatorPass; -// Internal options to set FSDiscriminatorPass. Used in merge and show -// commands. -static cl::opt FSDiscriminatorPassOption( - "fs-discriminator-pass", cl::init(PassLast), cl::Hidden, - cl::desc("Zero out the discriminator bits for the FS discrimiantor " - "pass beyond this value. The enum values are defined in " - "Support/Discriminator.h"), - cl::values(clEnumVal(Base, "Use base discriminators only"), - clEnumVal(Pass1, "Use base and pass 1 discriminators"), - clEnumVal(Pass2, "Use base and pass 1-2 discriminators"), - clEnumVal(Pass3, "Use base and pass 1-3 discriminators"), - clEnumVal(PassLast, "Use all discriminator bits (default)"))); - static unsigned getDiscriminatorMask() { - return getN1Bits(getFSPassBitEnd(FSDiscriminatorPassOption.getValue())); + return getN1Bits(getFSPassBitEnd(FSDiscriminatorPassOption)); } /// Adjust the instr profile in \p WC based on the sample profile in @@ -1504,8 +1201,8 @@ remapSamples(const sampleprof::FunctionSamples &Samples, BodySample.second.getSamples()); for (const auto &Target : BodySample.second.getCallTargets()) { Result.addCalledTargetSamples(BodySample.first.LineOffset, - MaskedDiscriminator, - Remapper(Target.first), Target.second); + MaskedDiscriminator, Remapper(Target.first), + Target.second); } } for (const auto &CallsiteSamples : Samples.getCallsiteSamples()) { @@ -1522,12 +1219,8 @@ remapSamples(const sampleprof::FunctionSamples &Samples, } static sampleprof::SampleProfileFormat FormatMap[] = { - sampleprof::SPF_None, - sampleprof::SPF_Text, - sampleprof::SPF_None, - sampleprof::SPF_Ext_Binary, - sampleprof::SPF_GCC, - sampleprof::SPF_Binary}; + sampleprof::SPF_None, sampleprof::SPF_Text, sampleprof::SPF_None, + sampleprof::SPF_Ext_Binary, sampleprof::SPF_GCC, sampleprof::SPF_Binary}; static std::unique_ptr getInputFileBuf(const StringRef &InputFile) { @@ -3375,9 +3068,8 @@ static int showDebugInfoCorrelation(const std::string &Filename, static int show_main(StringRef ProgName) { if (Filename.empty() && DebugInfoFilename.empty()) - exitWithError( - "the positional argument '' is required unless '--" + - DebugInfoFilename.ArgStr + "' is provided"); + exitWithError("the positional argument '' is required " + "unless '--debug-info' is provided"); if (Filename == OutputFilename) { errs() << ProgName @@ -3394,7 +3086,8 @@ static int show_main(StringRef ProgName) { exitWithErrorCode(EC, OutputFilename); if (ShowAllFunctions && !FuncNameFilter.empty()) - WithColor::warning() << "-function argument ignored: showing all functions\n"; + WithColor::warning() + << "-function argument ignored: showing all functions\n"; if (!DebugInfoFilename.empty()) return showDebugInfoCorrelation(DebugInfoFilename, SFormat, OS); @@ -3424,7 +3117,7 @@ static int order_main() { ArrayRef Traces = Reader->getTemporalProfTraces(); if (NumTestTraces && NumTestTraces >= Traces.size()) exitWithError( - "--" + NumTestTraces.ArgStr + + "--num-test-traces" " must be smaller than the total number of traces: expected: < " + Twine(Traces.size()) + ", actual: " + Twine(NumTestTraces)); ArrayRef TestTraces = Traces.take_back(NumTestTraces); @@ -3471,32 +3164,477 @@ static int order_main() { return 0; } -int main(int argc, const char *argv[]) { - InitLLVM X(argc, argv); - StringRef ProgName(sys::path::filename(argv[0])); +static void reportCmdLineError(const Twine &Message) { + WithColor::error(errs(), ProgramName) << Message << "\n"; +} + +template +static bool parseNumericOption(const opt::Arg *A, T &Value) { + if (!A) + return true; + StringRef V = A->getValue(); + T Parsed{}; + if (!llvm::to_integer(V, Parsed, 0)) { + if (!std::numeric_limits::is_signed && V == "-1") { + Value = std::numeric_limits::max(); + return true; + } + reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + + A->getSpelling() + "'"); + return false; + } + Value = Parsed; + return true; +} + +static bool parseFloatOption(const opt::Arg *A, float &Value) { + if (!A) + return true; + StringRef V = A->getValue(); + double Parsed; + if (V.getAsDouble(Parsed)) { + reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + + A->getSpelling() + "'"); + return false; + } + Value = static_cast(Parsed); + return true; +} + +static bool parseCutoffValues(const opt::InputArgList &Args, + std::vector &Cutoffs) { + Cutoffs.clear(); + for (const opt::Arg *A : Args.filtered(OPT_detailed_summary_cutoffs)) { + SmallVector Parts; + StringRef(A->getValue()) + .split(Parts, ',', /*MaxSplit=*/-1, + /*KeepEmpty=*/false); + for (StringRef Part : Parts) { + uint32_t Parsed; + if (!llvm::to_integer(Part, Parsed, 0)) { + reportCmdLineError(Twine("invalid argument '") + Part + + "' for option '" + A->getSpelling() + "'"); + return false; + } + Cutoffs.push_back(Parsed); + } + } + return true; +} + +static bool parseFSDiscriminatorPassArg(const opt::InputArgList &Args) { + const opt::Arg *A = Args.getLastArg(OPT_fs_discriminator_pass); + if (!A) + return true; + + StringRef Value = A->getValue(); + auto Parsed = StringSwitch>(Value) + .Case("Base", FSDiscriminatorPass::Base) + .Case("base", FSDiscriminatorPass::Base) + .Case("Pass1", FSDiscriminatorPass::Pass1) + .Case("pass1", FSDiscriminatorPass::Pass1) + .Case("Pass2", FSDiscriminatorPass::Pass2) + .Case("pass2", FSDiscriminatorPass::Pass2) + .Case("Pass3", FSDiscriminatorPass::Pass3) + .Case("pass3", FSDiscriminatorPass::Pass3) + .Case("PassLast", FSDiscriminatorPass::PassLast) + .Case("pass-last", FSDiscriminatorPass::PassLast) + .Case("passlast", FSDiscriminatorPass::PassLast) + .Default(std::nullopt); + if (!Parsed) { + reportCmdLineError(Twine("invalid argument '") + Value + "' for option '" + + A->getSpelling() + "'"); + return false; + } + FSDiscriminatorPassOption = *Parsed; + return true; +} + +static bool validateSubcommandOptions(const opt::InputArgList &Args, + StringRef Subcommand) { + bool Valid = true; + for (const opt::Arg *A : Args) { + if (A->getOption().matches(OPT_UNKNOWN) || + A->getOption().matches(OPT_INPUT)) + continue; + if (A->getOption().isRegisteredSC(Subcommand)) + continue; + reportCmdLineError(Twine("unknown command line argument '") + + A->getSpelling() + "' for subcommand '" + Subcommand + + "'. Try: '" + ProgramName + " " + Subcommand + + " --help'"); + Valid = false; + } + return Valid; +} + +static void printSubcommandHelp(const ProfdataOptTable &Tbl, + StringRef Subcommand, bool ShowHidden) { + SmallString<64> Usage; + Usage += ProgramName; + Usage += " "; + Usage += Subcommand; + Usage += " [options]"; + Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", ShowHidden, + /*ShowAllAliases=*/false, Visibility(), Subcommand); + outs() << "\nPass @FILE as argument to read options from FILE.\n"; +} + +static void printTopLevelHelp() { + outs() << "OVERVIEW: LLVM profile data\n\n" + << "USAGE: " << ProgramName << " [options]\n\n" + << "SUBCOMMANDS:\n"; + for (const auto &SC : OptionSubCommands) + outs() << " " << SC.Name << " - " << SC.HelpText << "\n"; + outs() << "\n Type \"" << ProgramName + << " --help\" to get more help on a specific " + "subcommand\n\n" + << "OPTIONS:\n --help Display this message\n" + << " --version Display the version\n"; +} + +static bool parseMergeOptions(const opt::InputArgList &Args) { + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); + if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) + ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; + + if (!parseNumericOption( + Args.getLastArg(OPT_max_debug_info_correlation_warnings), + MaxDbgCorrelationWarnings)) + return false; + ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); + DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); + BinaryFilename = Args.getLastArgValue(OPT_binary_file).str(); + DebugFileDirectory = Args.getAllArgValues(OPT_debug_file_directory); + DebugInfod = Args.hasArg(OPT_debuginfod); + + if (const opt::Arg *A = Args.getLastArg(OPT_correlate)) { + StringRef V = A->getValue(); + auto Parsed = StringSwitch>(V) + .Case("", InstrProfCorrelator::NONE) + .Case("debug-info", InstrProfCorrelator::DEBUG_INFO) + .Case("binary", InstrProfCorrelator::BINARY) + .Default(std::nullopt); + if (!Parsed) { + reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + + A->getSpelling() + "'"); + return false; + } + BIDFetcherProfileCorrelate = *Parsed; + } + + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); + InputFilenames = Args.getAllArgValues(OPT_INPUT); + WeightedInputFilenames = Args.getAllArgValues(OPT_weighted_input); + + OutputFormat = PF_Ext_Binary; + if (const opt::Arg *Fmt = + Args.getLastArg(OPT_binary, OPT_extbinary, OPT_text, OPT_gcc)) { + if (Fmt->getOption().matches(OPT_binary)) + OutputFormat = PF_Binary; + else if (Fmt->getOption().matches(OPT_gcc)) + OutputFormat = PF_GCC; + else if (Fmt->getOption().matches(OPT_text)) + OutputFormat = PF_Text; + else + OutputFormat = PF_Ext_Binary; + } + + InputFilenamesFile = Args.getLastArgValue(OPT_input_files).str(); + DumpInputFileList = Args.hasArg(OPT_dump_input_file_list); + RemappingFile = Args.getLastArgValue(OPT_remapping_file).str(); + UseMD5 = Args.hasArg(OPT_use_md5); + CompressAllSections = Args.hasArg(OPT_compress_all_sections); + SampleMergeColdContext = Args.hasArg(OPT_sample_merge_cold_context); + SampleTrimColdContext = Args.hasArg(OPT_sample_trim_cold_context); + if (!parseNumericOption( + Args.getLastArg(OPT_sample_frame_depth_for_cold_context), + SampleColdContextFrameDepth)) + return false; + if (!parseNumericOption(Args.getLastArg(OPT_output_size_limit), + OutputSizeLimit)) + return false; + GenPartialProfile = Args.hasArg(OPT_gen_partial_profile); + SplitLayout = Args.hasArg(OPT_split_layout); + SupplInstrWithSample = + Args.getLastArgValue(OPT_supplement_instr_with_sample).str(); + if (!parseFloatOption(Args.getLastArg(OPT_zero_counter_threshold), + ZeroCounterThreshold)) + return false; + if (!parseNumericOption(Args.getLastArg(OPT_suppl_min_size_threshold), + SupplMinSizeThreshold)) + return false; + if (!parseNumericOption(Args.getLastArg(OPT_instr_prof_cold_threshold), + InstrProfColdThreshold)) + return false; + if (!parseNumericOption( + Args.getLastArg(OPT_temporal_profile_trace_reservoir_size), + TemporalProfTraceReservoirSize)) + return false; + if (!parseNumericOption( + Args.getLastArg(OPT_temporal_profile_max_trace_length), + TemporalProfMaxTraceLength)) + return false; + FuncNameNegativeFilter = Args.getLastArgValue(OPT_no_function).str(); + + StringRef FailureModeValue = Args.getLastArgValue(OPT_failure_mode, "any"); + auto ParsedFailMode = + StringSwitch>(FailureModeValue) + .Case("warn", warnOnly) + .Case("any", failIfAnyAreInvalid) + .Case("all", failIfAllAreInvalid) + .Default(std::nullopt); + if (!ParsedFailMode) { + reportCmdLineError(Twine("invalid argument '") + FailureModeValue + + "' for option '--failure-mode'"); + return false; + } + FailMode = *ParsedFailMode; + + OutputSparse = Args.hasArg(OPT_sparse); + if (!parseNumericOption(Args.getLastArg(OPT_num_threads), NumThreads)) + return false; + ProfileSymbolListFile = Args.getLastArgValue(OPT_prof_sym_list).str(); + + if (const opt::Arg *A = Args.getLastArg(OPT_convert_sample_profile_layout)) { + StringRef Layout = A->getValue(); + auto ParsedLayout = StringSwitch>(Layout) + .Case("nest", SPL_Nest) + .Case("flat", SPL_Flat) + .Default(std::nullopt); + if (!ParsedLayout) { + reportCmdLineError(Twine("invalid argument '") + Layout + + "' for option '" + A->getSpelling() + "'"); + return false; + } + ProfileLayout = *ParsedLayout; + } + + DropProfileSymbolList = Args.hasArg(OPT_drop_profile_symbol_list); + KeepVTableSymbols = Args.hasArg(OPT_keep_vtable_symbols); + DoWritePrevVersion = Args.hasArg(OPT_write_prev_version); + + if (const opt::Arg *A = Args.getLastArg(OPT_memprof_version)) { + StringRef Version = A->getValue(); + auto ParsedVersion = + StringSwitch>(Version) + .Case("2", memprof::Version2) + .Case("3", memprof::Version3) + .Case("4", memprof::Version4) + .Default(std::nullopt); + if (!ParsedVersion) { + reportCmdLineError(Twine("invalid argument '") + Version + + "' for option '" + A->getSpelling() + "'"); + return false; + } + MemProfVersionRequested = *ParsedVersion; + } + + MemProfFullSchema = Args.hasArg(OPT_memprof_full_schema); + MemprofGenerateRandomHotness = Args.hasArg(OPT_memprof_random_hotness); + if (!parseNumericOption(Args.getLastArg(OPT_memprof_random_hotness_seed), + MemprofGenerateRandomHotnessSeed)) + return false; + + if (!parseFSDiscriminatorPassArg(Args)) + return false; + + return true; +} + +static bool parseShowOptions(const opt::InputArgList &Args) { + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); + std::vector Inputs = Args.getAllArgValues(OPT_INPUT); + if (!Inputs.empty()) { + Filename = Inputs.front(); + if (Inputs.size() > 1) { + reportCmdLineError("too many positional arguments"); + return false; + } + } + + if (!parseNumericOption( + Args.getLastArg(OPT_max_debug_info_correlation_warnings), + MaxDbgCorrelationWarnings)) + return false; + ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); + DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); + + ShowCounts = Args.hasArg(OPT_counts); + if (const opt::Arg *A = Args.getLastArg(OPT_show_format)) { + StringRef Value = A->getValue(); + auto Parsed = StringSwitch>(Value) + .Case("text", ShowFormat::Text) + .Case("json", ShowFormat::Json) + .Case("yaml", ShowFormat::Yaml) + .Default(std::nullopt); + if (!Parsed) { + reportCmdLineError(Twine("invalid argument '") + Value + + "' for option '" + A->getSpelling() + "'"); + return false; + } + SFormat = *Parsed; + } + TextFormat = Args.hasArg(OPT_text); + JsonFormat = Args.hasArg(OPT_json); + ShowIndirectCallTargets = Args.hasArg(OPT_ic_targets); + ShowVTables = Args.hasArg(OPT_show_vtables); + ShowMemOPSizes = Args.hasArg(OPT_memop_sizes); + ShowDetailedSummary = Args.hasArg(OPT_detailed_summary); + if (!parseCutoffValues(Args, DetailedSummaryCutoffs)) + return false; + ShowHotFuncList = Args.hasArg(OPT_hot_func_list); + ShowAllFunctions = Args.hasArg(OPT_all_functions); + ShowCS = Args.hasArg(OPT_showcs); + if (!parseNumericOption(Args.getLastArg(OPT_topn), TopNFunctions)) + return false; + if (!parseNumericOption(Args.getLastArg(OPT_value_cutoff), ShowValueCutoff)) + return false; + OnlyListBelow = Args.hasArg(OPT_list_below_cutoff); + ShowProfileSymbolList = Args.hasArg(OPT_show_prof_sym_list); + ShowSectionInfoOnly = Args.hasArg(OPT_show_sec_info_only); + ShowBinaryIds = Args.hasArg(OPT_binary_ids); + ShowTemporalProfTraces = Args.hasArg(OPT_temporal_profile_traces); + ShowCovered = Args.hasArg(OPT_covered); + ShowProfileVersion = Args.hasArg(OPT_profile_version); + + if (const opt::Arg *A = Args.getLastArg(OPT_memory, OPT_sample, OPT_instr)) { + if (A->getOption().matches(OPT_memory)) + ShowProfileKind = memory; + else if (A->getOption().matches(OPT_sample)) + ShowProfileKind = sample; + else + ShowProfileKind = instr; + } + + if (!parseFSDiscriminatorPassArg(Args)) + return false; + + return true; +} + +static bool parseOverlapOptions(const opt::InputArgList &Args) { + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); + std::vector Inputs = Args.getAllArgValues(OPT_INPUT); + if (Inputs.size() != 2) { + reportCmdLineError("overlap requires two positional profile filenames"); + return false; + } + BaseFilename = Inputs[0]; + TestFilename = Inputs[1]; + + if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) + ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; + + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); + if (!parseNumericOption(Args.getLastArg(OPT_similarity_cutoff), + SimilarityCutoff)) + return false; + IsCS = Args.hasArg(OPT_cs); + if (!parseNumericOption(Args.getLastArg(OPT_value_cutoff), + OverlapValueCutoff)) + return false; + + if (!parseFSDiscriminatorPassArg(Args)) + return false; + + return true; +} + +static bool parseOrderOptions(const opt::InputArgList &Args) { + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); + std::vector Inputs = Args.getAllArgValues(OPT_INPUT); + if (!Inputs.empty()) { + Filename = Inputs.front(); + if (Inputs.size() > 1) { + reportCmdLineError("too many positional arguments"); + return false; + } + } + if (!parseNumericOption(Args.getLastArg(OPT_num_test_traces), NumTestTraces)) + return false; + return true; +} + +int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { + BumpPtrAllocator Alloc; + StringSaver Saver(Alloc); + + ProgramName = sys::path::filename(argv[0]).str(); if (argc < 2) { - errs() - << ProgName - << ": No subcommand specified! Run llvm-profdata --help for usage.\n"; + errs() << ProgramName << ": No subcommand specified! Run " << ProgramName + << " --help for usage.\n"; return 1; } - cl::ParseCommandLineOptions(argc, argv, "LLVM profile data\n"); + StringRef Subcommand = argv[1]; + if (Subcommand == "--help" || Subcommand == "-help" || Subcommand == "-h") { + printTopLevelHelp(); + return 0; + } - if (ShowSubcommand) - return show_main(ProgName); + if (Subcommand == "--version" || Subcommand == "-version") { + outs() << ProgramName << '\n'; + cl::PrintVersionMessage(); + return 0; + } - if (OrderSubcommand) - return order_main(); + if (Subcommand != "show" && Subcommand != "order" && + Subcommand != "overlap" && Subcommand != "merge") { + errs() << ProgramName << ": Unknown command. Run " << ProgramName + << " --help for usage.\n"; + return 1; + } - if (OverlapSubcommand) - return overlap_main(); + ProfdataOptTable Tbl; + bool HadParseError = false; + opt::InputArgList Args = + Tbl.parseArgs(argc - 2, argv + 2, OPT_UNKNOWN, Saver, [&](StringRef Msg) { + WithColor::error(errs(), ProgramName) << Msg << "\n"; + HadParseError = true; + }); + if (HadParseError) + return 1; - if (MergeSubcommand) - return merge_main(ProgName); + bool ShowHidden = Args.hasArg(OPT_help_hidden); + if (Args.hasArg(OPT_help) || ShowHidden) { + printSubcommandHelp(Tbl, Subcommand, ShowHidden); + return 0; + } + + if (!validateSubcommandOptions(Args, Subcommand)) + return 1; + + if (Args.hasArg(OPT_version)) { + outs() << ProgramName << '\n'; + cl::PrintVersionMessage(); + return 0; + } + + if (Subcommand == "merge") { + if (!parseMergeOptions(Args)) + return 1; + return merge_main(ProgramName); + } + if (Subcommand == "show") { + if (!parseShowOptions(Args)) + return 1; + return show_main(ProgramName); + } + if (Subcommand == "overlap") { + if (!parseOverlapOptions(Args)) + return 1; + return overlap_main(); + } + if (Subcommand == "order") { + if (!parseOrderOptions(Args)) + return 1; + return order_main(); + } - errs() << ProgName - << ": Unknown command. Run llvm-profdata --help for usage.\n"; + errs() << ProgramName << ": Unknown command. Run " << ProgramName + << " --help for usage.\n"; return 1; } diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel index 97ec5c8bca39e..dc217486f396e 100644 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -5870,12 +5870,23 @@ cc_library( ":Core", ":Debuginfod", ":Object", + ":Option", + ":ProfdataOptsTableGen", ":ProfileData", ":Support", ], ) -cc_binary( +gentbl_cc_library( + name = "ProfdataOptsTableGen", + strip_include_prefix = "tools/llvm-profdata", + tbl_outs = {"tools/llvm-profdata/Opts.inc": ["-gen-opt-parser-defs"]}, + tblgen = ":llvm-tblgen", + td_file = "tools/llvm-profdata/Opts.td", + deps = [":OptParserTdFiles"], +) + +llvm_driver_cc_binary( name = "llvm-profdata", stamp = 0, deps = [":llvm-profdata-lib"], diff --git a/utils/bazel/llvm-project-overlay/llvm/driver.bzl b/utils/bazel/llvm-project-overlay/llvm/driver.bzl index e38c681370ed1..331e3f7e0db1f 100644 --- a/utils/bazel/llvm-project-overlay/llvm/driver.bzl +++ b/utils/bazel/llvm-project-overlay/llvm/driver.bzl @@ -28,6 +28,7 @@ _TOOLS = { "llvm-nm": "//llvm:llvm-nm-lib", "llvm-objcopy": "//llvm:llvm-objcopy-lib", "llvm-objdump": "//llvm:llvm-objdump-lib", + "llvm-profdata": "//llvm:llvm-profdata-lib", "llvm-rc": "//llvm:llvm-rc-lib", "llvm-readobj": "//llvm:llvm-readobj-lib", "llvm-size": "//llvm:llvm-size-lib", From 5c8b2206fd1941b810357243e15283148b9d84f8 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Mon, 26 Jan 2026 13:53:58 -0500 Subject: [PATCH 2/6] CR feedback --- llvm/test/tools/llvm-profdata/help.test | 22 ++ llvm/tools/llvm-profdata/Opts.td | 70 +++- llvm/tools/llvm-profdata/llvm-profdata.cpp | 414 ++++++++++++++++----- 3 files changed, 403 insertions(+), 103 deletions(-) create mode 100644 llvm/test/tools/llvm-profdata/help.test diff --git a/llvm/test/tools/llvm-profdata/help.test b/llvm/test/tools/llvm-profdata/help.test new file mode 100644 index 0000000000000..b1b1c6da8dd72 --- /dev/null +++ b/llvm/test/tools/llvm-profdata/help.test @@ -0,0 +1,22 @@ +# RUN: llvm-profdata --help | FileCheck %s --check-prefix=TOP +# RUN: llvm-profdata merge --help | FileCheck %s --check-prefix=MERGE +# RUN: llvm-profdata show --help | FileCheck %s --check-prefix=SHOW + +# TOP: OVERVIEW: LLVM profile data +# TOP: USAGE: llvm-profdata [subcommand] [options] +# TOP: SUBCOMMANDS: +# TOP: merge - Takes several profiles and merge them together. +# TOP: show - Takes a profile data file and displays the profiles. + +# MERGE: OVERVIEW: LLVM profile data +# MERGE: Takes several profiles and merge them together. +# MERGE: OPTIONS: +# MERGE: -instr +# MERGE: -output +# MERGE: -sample + +# SHOW: OVERVIEW: LLVM profile data +# SHOW: Takes a profile data file and displays the profiles. +# SHOW: OPTIONS: +# SHOW: -output +# SHOW: -show-format diff --git a/llvm/tools/llvm-profdata/Opts.td b/llvm/tools/llvm-profdata/Opts.td index 8803af9a10123..5244e9638ff16 100644 --- a/llvm/tools/llvm-profdata/Opts.td +++ b/llvm/tools/llvm-profdata/Opts.td @@ -118,6 +118,11 @@ def compress_all_sections HelpText<"Compress all sections when writing the profile (only " "meaningful for -extbinary)">, Flags<[HelpHidden]>; +def compress_all_sections_EQ + : Joined<["-","--"], "compress-all-sections=", [Merge]>, + HelpText<"Compress all sections when writing the profile (only " + "meaningful for -extbinary)">, + Flags<[HelpHidden]>; def sample_merge_cold_context : Flag<["-","--"], "sample-merge-cold-context", [Merge]>, HelpText<"Merge context sample profiles whose count is below cold " @@ -188,8 +193,65 @@ def failure_mode : JoinedOrSeparate<["-","--"], "failure-mode", [Merge]>, HelpText<"Failure mode: warn, any, or all">, MetaVarName<"">; -def sparse : Flag<["-","--"], "sparse", [Merge]>, - HelpText<"Generate a sparse profile (only meaningful for -instr)">; +def sparse + : Flag<["-","--"], "sparse", [Merge]>, + HelpText<"Generate a sparse profile (only meaningful for -instr)">; +def sparse_EQ + : Joined<["-","--"], "sparse=", [Merge]>, + HelpText<"Generate a sparse profile (only meaningful for -instr)">, + Flags<[HelpHidden]>; + +def profile_isfs : Flag<["-","--"], "profile-isfs", [Show, Merge]>, + HelpText<"Profile uses flow-sensitive discriminators">, + Flags<[HelpHidden]>; + +def generate_merged_base_profiles + : JoinedOrSeparate<["-","--"], "generate-merged-base-profiles", [Merge]>, + HelpText<"Generate merged base profiles when creating nested " + "context-sensitive profiles">, + Flags<[HelpHidden]>; + +def profile_symbol_list_cutoff + : JoinedOrSeparate<["-","--"], "profile-symbol-list-cutoff", [Merge]>, + HelpText<"Maximum number of symbols to keep in the profile symbol list">, + Flags<[HelpHidden]>; +def profile_summary_cutoff_hot + : JoinedOrSeparate<["-","--"], "profile-summary-cutoff-hot", + [Show, Merge]>, + HelpText<"Percentile (times 10000) for determining hot threshold">, + Flags<[HelpHidden]>; +def profile_summary_cutoff_cold + : JoinedOrSeparate<["-","--"], "profile-summary-cutoff-cold", + [Show, Merge]>, + HelpText<"Percentile (times 10000) for determining cold threshold">, + Flags<[HelpHidden]>; +def profile_summary_hot_count + : JoinedOrSeparate<["-","--"], "profile-summary-hot-count", + [Show, Merge]>, + HelpText<"Override hot count derived from summary cutoffs">, + Flags<[HelpHidden]>; +def profile_summary_cold_count + : JoinedOrSeparate<["-","--"], "profile-summary-cold-count", + [Show, Merge]>, + HelpText<"Override cold count derived from summary cutoffs">, + Flags<[HelpHidden]>; +def profile_summary_contextless + : JoinedOrSeparate<["-","--"], "profile-summary-contextless", + [Show, Merge]>, + HelpText<"Merge context profiles before calculating summary thresholds">, + Flags<[HelpHidden]>; +def profile_summary_huge_working_set_size_threshold + : JoinedOrSeparate<["-","--"], + "profile-summary-huge-working-set-size-threshold", + [Show, Merge]>, + HelpText<"Threshold for huge working set size used in profile summary">, + Flags<[HelpHidden]>; +def profile_summary_large_working_set_size_threshold + : JoinedOrSeparate<["-","--"], + "profile-summary-large-working-set-size-threshold", + [Show, Merge]>, + HelpText<"Threshold for large working set size used in profile summary">, + Flags<[HelpHidden]>; def num_threads : JoinedOrSeparate<["-","--"], "num-threads", [Merge]>, HelpText<"Number of merge threads to use (default: autodetect)">, MetaVarName<"">; @@ -261,6 +323,10 @@ def ic_targets : Flag<["-","--"], "ic-targets", [Show]>, HelpText<"Show indirect call site target values">; def show_vtables : Flag<["-","--"], "show-vtables", [Show]>, HelpText<"Show vtable names for shown functions">; +def extbinary_write_vtable_type_prof + : Flag<["-","--"], "extbinary-write-vtable-type-prof", [Merge]>, + HelpText<"Include vtable type profile data in ext-binary sample profile">, + Flags<[HelpHidden]>; def memop_sizes : Flag<["-","--"], "memop-sizes", [Show]>, HelpText<"Show profiled sizes of memory intrinsic calls">; def detailed_summary : Flag<["-","--"], "detailed-summary", [Show]>, diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 4c8c7519df9ca..5215578eede46 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -3168,11 +3168,56 @@ static void reportCmdLineError(const Twine &Message) { WithColor::error(errs(), ProgramName) << Message << "\n"; } +static StringRef getOptionValue(const opt::Arg *A) { + if (A->getNumValues() == 0) + return StringRef(); + StringRef V = A->getValue(); + V.consume_front("="); + return V; +} + +static std::string getLastArgValueClean(const opt::InputArgList &Args, + unsigned OptionID, + StringRef Default = "") { + if (const opt::Arg *A = Args.getLastArg(OptionID)) + return getOptionValue(A).str(); + return Default.str(); +} + +static std::vector +getAllArgValuesClean(const opt::InputArgList &Args, unsigned OptionID) { + std::vector Values; + for (const opt::Arg *A : Args.filtered(OptionID)) + Values.push_back(getOptionValue(A).str()); + return Values; +} + +static bool parseBooleanOption(const opt::Arg *A, bool &Value) { + if (!A) + return true; + StringRef V = getOptionValue(A); + if (V.empty()) { + Value = true; + return true; + } + if (V.equals_insensitive("true") || V == "1") { + Value = true; + return true; + } + if (V.equals_insensitive("false") || V == "0") { + Value = false; + return true; + } + reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + + A->getSpelling() + "'"); + return false; +} + template static bool parseNumericOption(const opt::Arg *A, T &Value) { if (!A) return true; - StringRef V = A->getValue(); + StringRef V = getOptionValue(A); T Parsed{}; if (!llvm::to_integer(V, Parsed, 0)) { if (!std::numeric_limits::is_signed && V == "-1") { @@ -3187,10 +3232,86 @@ static bool parseNumericOption(const opt::Arg *A, T &Value) { return true; } +static bool applyLibraryOptionsWithCL(const opt::InputArgList &Args) { + SmallVector CLStrings; + CLStrings.push_back(ProgramName); + + auto AddBool = [&](unsigned OptID, StringRef Spelling) -> bool { + if (const opt::Arg *A = Args.getLastArg(OptID)) { + bool Value = true; + if (!parseBooleanOption(A, Value)) + return false; + CLStrings.push_back( + (Spelling + Twine("=") + (Value ? "true" : "false")).str()); + } + return true; + }; + auto AddUInt = [&](unsigned OptID, StringRef Spelling) -> bool { + if (const opt::Arg *A = Args.getLastArg(OptID)) { + uint64_t Value = 0; + if (!parseNumericOption(A, Value)) + return false; + CLStrings.push_back((Spelling + Twine("=") + Twine(Value)).str()); + } + return true; + }; + auto AddInt = [&](unsigned OptID, StringRef Spelling) -> bool { + if (const opt::Arg *A = Args.getLastArg(OptID)) { + int Value = 0; + if (!parseNumericOption(A, Value)) + return false; + CLStrings.push_back((Spelling + Twine("=") + Twine(Value)).str()); + } + return true; + }; + + if (!AddBool(OPT_profile_isfs, "--profile-isfs")) + return false; + if (!AddBool(OPT_generate_merged_base_profiles, + "--generate-merged-base-profiles")) + return false; + if (!AddUInt(OPT_profile_symbol_list_cutoff, "--profile-symbol-list-cutoff")) + return false; + if (!AddBool(OPT_extbinary_write_vtable_type_prof, + "--extbinary-write-vtable-type-prof")) + return false; + + if (!AddBool(OPT_profile_summary_contextless, + "--profile-summary-contextless")) + return false; + if (!AddInt(OPT_profile_summary_cutoff_hot, "--profile-summary-cutoff-hot")) + return false; + if (!AddInt(OPT_profile_summary_cutoff_cold, "--profile-summary-cutoff-cold")) + return false; + if (!AddUInt(OPT_profile_summary_hot_count, "--profile-summary-hot-count")) + return false; + if (!AddUInt(OPT_profile_summary_cold_count, "--profile-summary-cold-count")) + return false; + if (!AddUInt(OPT_profile_summary_huge_working_set_size_threshold, + "--profile-summary-huge-working-set-size-threshold")) + return false; + if (!AddUInt(OPT_profile_summary_large_working_set_size_threshold, + "--profile-summary-large-working-set-size-threshold")) + return false; + + if (CLStrings.size() == 1) + return true; + + SmallVector CLArgs; + for (std::string &S : CLStrings) + CLArgs.push_back(S.data()); + + return cl::ParseCommandLineOptions(CLArgs.size(), CLArgs.data(), + /*Overview=*/"", /*Errs=*/nullptr, + /*VFS=*/nullptr, + /*EnvVar=*/nullptr, + /*LongOptionsUseDoubleDash=*/false); +} + static bool parseFloatOption(const opt::Arg *A, float &Value) { if (!A) return true; - StringRef V = A->getValue(); + StringRef V = getOptionValue(A); double Parsed; if (V.getAsDouble(Parsed)) { reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + @@ -3206,9 +3327,17 @@ static bool parseCutoffValues(const opt::InputArgList &Args, Cutoffs.clear(); for (const opt::Arg *A : Args.filtered(OPT_detailed_summary_cutoffs)) { SmallVector Parts; - StringRef(A->getValue()) - .split(Parts, ',', /*MaxSplit=*/-1, - /*KeepEmpty=*/false); + if (A->getNumValues() <= 1) { + getOptionValue(A).split(Parts, ',', /*MaxSplit=*/-1, + /*KeepEmpty=*/false); + } else { + for (unsigned I = 0, E = A->getNumValues(); I != E; ++I) { + StringRef Part = A->getValue(I); + if (!Part.empty() && Part.front() == '=') + Part = Part.drop_front(); + Parts.push_back(Part); + } + } for (StringRef Part : Parts) { uint32_t Parsed; if (!llvm::to_integer(Part, Parsed, 0)) { @@ -3227,7 +3356,7 @@ static bool parseFSDiscriminatorPassArg(const opt::InputArgList &Args) { if (!A) return true; - StringRef Value = A->getValue(); + StringRef Value = getOptionValue(A); auto Parsed = StringSwitch>(Value) .Case("Base", FSDiscriminatorPass::Base) .Case("base", FSDiscriminatorPass::Base) @@ -3268,48 +3397,26 @@ static bool validateSubcommandOptions(const opt::InputArgList &Args, return Valid; } -static void printSubcommandHelp(const ProfdataOptTable &Tbl, - StringRef Subcommand, bool ShowHidden) { - SmallString<64> Usage; - Usage += ProgramName; - Usage += " "; - Usage += Subcommand; - Usage += " [options]"; - Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", ShowHidden, - /*ShowAllAliases=*/false, Visibility(), Subcommand); - outs() << "\nPass @FILE as argument to read options from FILE.\n"; -} - -static void printTopLevelHelp() { - outs() << "OVERVIEW: LLVM profile data\n\n" - << "USAGE: " << ProgramName << " [options]\n\n" - << "SUBCOMMANDS:\n"; - for (const auto &SC : OptionSubCommands) - outs() << " " << SC.Name << " - " << SC.HelpText << "\n"; - outs() << "\n Type \"" << ProgramName - << " --help\" to get more help on a specific " - "subcommand\n\n" - << "OPTIONS:\n --help Display this message\n" - << " --version Display the version\n"; -} - -static bool parseMergeOptions(const opt::InputArgList &Args) { - OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); +static bool parseMergeOptions(const opt::InputArgList &Args, + ArrayRef Positionals) { + OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; + if (!applyLibraryOptionsWithCL(Args)) + return false; if (!parseNumericOption( Args.getLastArg(OPT_max_debug_info_correlation_warnings), MaxDbgCorrelationWarnings)) return false; - ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); - DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); - BinaryFilename = Args.getLastArgValue(OPT_binary_file).str(); - DebugFileDirectory = Args.getAllArgValues(OPT_debug_file_directory); + ProfiledBinary = getLastArgValueClean(Args, OPT_profiled_binary); + DebugInfoFilename = getLastArgValueClean(Args, OPT_debug_info); + BinaryFilename = getLastArgValueClean(Args, OPT_binary_file); + DebugFileDirectory = getAllArgValuesClean(Args, OPT_debug_file_directory); DebugInfod = Args.hasArg(OPT_debuginfod); if (const opt::Arg *A = Args.getLastArg(OPT_correlate)) { - StringRef V = A->getValue(); + StringRef V = getOptionValue(A); auto Parsed = StringSwitch>(V) .Case("", InstrProfCorrelator::NONE) .Case("debug-info", InstrProfCorrelator::DEBUG_INFO) @@ -3323,9 +3430,12 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { BIDFetcherProfileCorrelate = *Parsed; } - FuncNameFilter = Args.getLastArgValue(OPT_function).str(); - InputFilenames = Args.getAllArgValues(OPT_INPUT); - WeightedInputFilenames = Args.getAllArgValues(OPT_weighted_input); + FuncNameFilter = getLastArgValueClean(Args, OPT_function); + InputFilenames.clear(); + InputFilenames.reserve(Positionals.size()); + for (StringRef Pos : Positionals) + InputFilenames.emplace_back(Pos.str()); + WeightedInputFilenames = getAllArgValuesClean(Args, OPT_weighted_input); OutputFormat = PF_Ext_Binary; if (const opt::Arg *Fmt = @@ -3340,11 +3450,15 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { OutputFormat = PF_Ext_Binary; } - InputFilenamesFile = Args.getLastArgValue(OPT_input_files).str(); + InputFilenamesFile = getLastArgValueClean(Args, OPT_input_files); DumpInputFileList = Args.hasArg(OPT_dump_input_file_list); - RemappingFile = Args.getLastArgValue(OPT_remapping_file).str(); + RemappingFile = getLastArgValueClean(Args, OPT_remapping_file); UseMD5 = Args.hasArg(OPT_use_md5); - CompressAllSections = Args.hasArg(OPT_compress_all_sections); + const opt::Arg *CompressArg = + Args.getLastArg(OPT_compress_all_sections, OPT_compress_all_sections_EQ); + CompressAllSections = CompressArg != nullptr; + if (!parseBooleanOption(CompressArg, CompressAllSections)) + return false; SampleMergeColdContext = Args.hasArg(OPT_sample_merge_cold_context); SampleTrimColdContext = Args.hasArg(OPT_sample_trim_cold_context); if (!parseNumericOption( @@ -3357,7 +3471,7 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { GenPartialProfile = Args.hasArg(OPT_gen_partial_profile); SplitLayout = Args.hasArg(OPT_split_layout); SupplInstrWithSample = - Args.getLastArgValue(OPT_supplement_instr_with_sample).str(); + getLastArgValueClean(Args, OPT_supplement_instr_with_sample); if (!parseFloatOption(Args.getLastArg(OPT_zero_counter_threshold), ZeroCounterThreshold)) return false; @@ -3375,9 +3489,12 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { Args.getLastArg(OPT_temporal_profile_max_trace_length), TemporalProfMaxTraceLength)) return false; - FuncNameNegativeFilter = Args.getLastArgValue(OPT_no_function).str(); + FuncNameNegativeFilter = getLastArgValueClean(Args, OPT_no_function); - StringRef FailureModeValue = Args.getLastArgValue(OPT_failure_mode, "any"); + StringRef FailureModeValue = + Args.getLastArg(OPT_failure_mode) + ? getOptionValue(Args.getLastArg(OPT_failure_mode)) + : StringRef("any"); auto ParsedFailMode = StringSwitch>(FailureModeValue) .Case("warn", warnOnly) @@ -3391,13 +3508,16 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { } FailMode = *ParsedFailMode; - OutputSparse = Args.hasArg(OPT_sparse); + const opt::Arg *SparseArg = Args.getLastArg(OPT_sparse, OPT_sparse_EQ); + OutputSparse = SparseArg != nullptr; + if (!parseBooleanOption(SparseArg, OutputSparse)) + return false; if (!parseNumericOption(Args.getLastArg(OPT_num_threads), NumThreads)) return false; - ProfileSymbolListFile = Args.getLastArgValue(OPT_prof_sym_list).str(); + ProfileSymbolListFile = getLastArgValueClean(Args, OPT_prof_sym_list); if (const opt::Arg *A = Args.getLastArg(OPT_convert_sample_profile_layout)) { - StringRef Layout = A->getValue(); + StringRef Layout = getOptionValue(A); auto ParsedLayout = StringSwitch>(Layout) .Case("nest", SPL_Nest) .Case("flat", SPL_Flat) @@ -3415,7 +3535,7 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { DoWritePrevVersion = Args.hasArg(OPT_write_prev_version); if (const opt::Arg *A = Args.getLastArg(OPT_memprof_version)) { - StringRef Version = A->getValue(); + StringRef Version = getOptionValue(A); auto ParsedVersion = StringSwitch>(Version) .Case("2", memprof::Version2) @@ -3442,12 +3562,12 @@ static bool parseMergeOptions(const opt::InputArgList &Args) { return true; } -static bool parseShowOptions(const opt::InputArgList &Args) { - OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); - std::vector Inputs = Args.getAllArgValues(OPT_INPUT); - if (!Inputs.empty()) { - Filename = Inputs.front(); - if (Inputs.size() > 1) { +static bool parseShowOptions(const opt::InputArgList &Args, + ArrayRef Positionals) { + OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + if (!Positionals.empty()) { + Filename = Positionals.front().str(); + if (Positionals.size() > 1) { reportCmdLineError("too many positional arguments"); return false; } @@ -3457,13 +3577,15 @@ static bool parseShowOptions(const opt::InputArgList &Args) { Args.getLastArg(OPT_max_debug_info_correlation_warnings), MaxDbgCorrelationWarnings)) return false; - ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); - DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); - FuncNameFilter = Args.getLastArgValue(OPT_function).str(); + if (!applyLibraryOptionsWithCL(Args)) + return false; + ProfiledBinary = getLastArgValueClean(Args, OPT_profiled_binary); + DebugInfoFilename = getLastArgValueClean(Args, OPT_debug_info); + FuncNameFilter = getLastArgValueClean(Args, OPT_function); ShowCounts = Args.hasArg(OPT_counts); if (const opt::Arg *A = Args.getLastArg(OPT_show_format)) { - StringRef Value = A->getValue(); + StringRef Value = getOptionValue(A); auto Parsed = StringSwitch>(Value) .Case("text", ShowFormat::Text) .Case("json", ShowFormat::Json) @@ -3514,20 +3636,20 @@ static bool parseShowOptions(const opt::InputArgList &Args) { return true; } -static bool parseOverlapOptions(const opt::InputArgList &Args) { - OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); - std::vector Inputs = Args.getAllArgValues(OPT_INPUT); - if (Inputs.size() != 2) { +static bool parseOverlapOptions(const opt::InputArgList &Args, + ArrayRef Positionals) { + OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + if (Positionals.size() != 2) { reportCmdLineError("overlap requires two positional profile filenames"); return false; } - BaseFilename = Inputs[0]; - TestFilename = Inputs[1]; + BaseFilename = Positionals[0].str(); + TestFilename = Positionals[1].str(); if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; - FuncNameFilter = Args.getLastArgValue(OPT_function).str(); + FuncNameFilter = getLastArgValueClean(Args, OPT_function); if (!parseNumericOption(Args.getLastArg(OPT_similarity_cutoff), SimilarityCutoff)) return false; @@ -3542,12 +3664,12 @@ static bool parseOverlapOptions(const opt::InputArgList &Args) { return true; } -static bool parseOrderOptions(const opt::InputArgList &Args) { - OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); - std::vector Inputs = Args.getAllArgValues(OPT_INPUT); - if (!Inputs.empty()) { - Filename = Inputs.front(); - if (Inputs.size() > 1) { +static bool parseOrderOptions(const opt::InputArgList &Args, + ArrayRef Positionals) { + OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + if (!Positionals.empty()) { + Filename = Positionals.front().str(); + if (Positionals.size() > 1) { reportCmdLineError("too many positional arguments"); return false; } @@ -3561,49 +3683,139 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { BumpPtrAllocator Alloc; StringSaver Saver(Alloc); - ProgramName = sys::path::filename(argv[0]).str(); - - if (argc < 2) { - errs() << ProgramName << ": No subcommand specified! Run " << ProgramName - << " --help for usage.\n"; - return 1; - } - - StringRef Subcommand = argv[1]; - if (Subcommand == "--help" || Subcommand == "-help" || Subcommand == "-h") { - printTopLevelHelp(); - return 0; - } + ProgramName = sys::path::stem(argv[0]).str(); - if (Subcommand == "--version" || Subcommand == "-version") { - outs() << ProgramName << '\n'; - cl::PrintVersionMessage(); - return 0; + ProfdataOptTable Tbl; + ArrayRef KnownSubcommands = Tbl.getSubCommands(); + auto IsKnownSubcommand = [&](StringRef Name) { + return llvm::any_of( + KnownSubcommands, + [&](const opt::OptTable::SubCommand &SC) { return Name == SC.Name; }); + }; + ArrayRef RawArgs(argv + 1, argv + argc); + SmallVector RawSubcommands; + for (const char *Arg : RawArgs) { + StringRef ArgRef(Arg); + if (!ArgRef.starts_with("-") && IsKnownSubcommand(ArgRef)) + RawSubcommands.push_back(ArgRef); + } + auto HasFlag = [&](StringRef Flag) { + return llvm::is_contained(RawArgs, Flag); + }; + auto HasAnySubcommand = [&]() { return !RawSubcommands.empty(); }; + + if (!HasAnySubcommand()) { + if (HasFlag("--help") || HasFlag("-help") || HasFlag("-h")) { + std::string Usage = ProgramName + " [subcommand] [options]"; + Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", + /*ShowHidden=*/false, /*ShowAllAliases=*/false, + Visibility(), /*Subcommand=*/{}); + return 0; + } + if (HasFlag("--help-hidden")) { + std::string Usage = ProgramName + " [subcommand] [options]"; + Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", + /*ShowHidden=*/true, /*ShowAllAliases=*/false, Visibility(), + /*Subcommand=*/{}); + return 0; + } + if (HasFlag("--version") || HasFlag("-version")) { + outs() << ProgramName << '\n'; + cl::PrintVersionMessage(); + return 0; + } } - if (Subcommand != "show" && Subcommand != "order" && - Subcommand != "overlap" && Subcommand != "merge") { - errs() << ProgramName << ": Unknown command. Run " << ProgramName + if (argc <= 1) { + errs() << ProgramName << ": No subcommand specified! Run " << ProgramName << " --help for usage.\n"; return 1; } - ProfdataOptTable Tbl; bool HadParseError = false; opt::InputArgList Args = - Tbl.parseArgs(argc - 2, argv + 2, OPT_UNKNOWN, Saver, [&](StringRef Msg) { + Tbl.parseArgs(argc - 1, argv + 1, OPT_UNKNOWN, Saver, [&](StringRef Msg) { WithColor::error(errs(), ProgramName) << Msg << "\n"; HadParseError = true; }); if (HadParseError) return 1; + bool HadSubcommandError = false; + SmallVector OtherPositionals; + auto HandleMultipleSubcommands = [&](ArrayRef SubCommands) { + HadSubcommandError = true; + WithColor::error(errs(), ProgramName) << "multiple subcommands specified:"; + for (StringRef SC : SubCommands) + errs() << " '" << SC << "'"; + errs() << ".\n"; + }; + auto HandleOtherPositionals = [&](ArrayRef Positionals) { + OtherPositionals.append(Positionals.begin(), Positionals.end()); + }; + + StringRef Subcommand = Args.getSubCommand( + Tbl.getSubCommands(), HandleMultipleSubcommands, HandleOtherPositionals); + if (HadSubcommandError) + return 1; + + if (Subcommand.empty() && RawSubcommands.size() > 1) { + HadSubcommandError = true; + HandleMultipleSubcommands(RawSubcommands); + } + if (HadSubcommandError) + return 1; + + if (Subcommand.empty() && argc > 1 && IsKnownSubcommand(argv[1])) + Subcommand = argv[1]; + if (Subcommand.empty() && !OtherPositionals.empty() && + IsKnownSubcommand(OtherPositionals.front())) { + Subcommand = OtherPositionals.front(); + OtherPositionals.erase(OtherPositionals.begin()); + } + if (Subcommand.empty() && RawSubcommands.size() == 1) + Subcommand = RawSubcommands.front(); + if (!Subcommand.empty()) { + auto It = llvm::find(OtherPositionals, Subcommand); + if (It != OtherPositionals.end()) + OtherPositionals.erase(It); + } + + ArrayRef Positionals = OtherPositionals; + bool ShowHidden = Args.hasArg(OPT_help_hidden); if (Args.hasArg(OPT_help) || ShowHidden) { - printSubcommandHelp(Tbl, Subcommand, ShowHidden); + std::string Usage = ProgramName + " [subcommand] [options]"; + Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", + /*ShowHidden=*/ShowHidden, /*ShowAllAliases=*/false, + Visibility(), Subcommand); return 0; } + if (Subcommand.empty()) { + if (Args.hasArg(OPT_version)) { + outs() << ProgramName << '\n'; + cl::PrintVersionMessage(); + return 0; + } + if (!OtherPositionals.empty()) { + WithColor::error(errs(), ProgramName) << "Unknown command"; + if (OtherPositionals.size() != 1) + errs() << "s"; + errs() << " "; + for (size_t I = 0; I < OtherPositionals.size(); ++I) { + if (I) + errs() << ", "; + errs() << "'" << OtherPositionals[I] << "'"; + } + errs() << ". Run " << ProgramName << " --help for usage.\n"; + } else { + errs() << ProgramName << ": No subcommand specified! Run " << ProgramName + << " --help for usage.\n"; + } + return 1; + } + if (!validateSubcommandOptions(Args, Subcommand)) return 1; @@ -3614,22 +3826,22 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { } if (Subcommand == "merge") { - if (!parseMergeOptions(Args)) + if (!parseMergeOptions(Args, Positionals)) return 1; return merge_main(ProgramName); } if (Subcommand == "show") { - if (!parseShowOptions(Args)) + if (!parseShowOptions(Args, Positionals)) return 1; return show_main(ProgramName); } if (Subcommand == "overlap") { - if (!parseOverlapOptions(Args)) + if (!parseOverlapOptions(Args, Positionals)) return 1; return overlap_main(); } if (Subcommand == "order") { - if (!parseOrderOptions(Args)) + if (!parseOrderOptions(Args, Positionals)) return 1; return order_main(); } From 3006cedd3e64fe7266a82792be236496d5ab9865 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Thu, 5 Feb 2026 08:36:59 -0500 Subject: [PATCH 3/6] Adjust tests for new parsing style --- bolt/docs/OptimizingClang.md | 2 +- clang/docs/SourceBasedCodeCoverage.rst | 4 +- clang/docs/UsersManual.rst | 10 +- clang/test/CodeGenCXX/profile-remap.cpp | 4 +- .../optimization-remark-with-hotness-new-pm.c | 2 +- clang/test/Profile/cxx-hash-v2.cpp | 2 +- .../ContinuousSyncMode/multi-threaded.cpp | 2 +- .../Darwin/instrprof-debug-info-correlate.c | 8 +- ...instrprof-debug-info-correlate-warnings.ll | 4 +- .../Linux/instrprof-debug-info-correlate.c | 10 +- .../profile/Linux/instrprof-instr-suppl.test | 8 +- .../instrprof-show-debug-info-correlation.c | 6 +- .../profile/Linux/instrprof-value-merge-lld.c | 2 +- .../profile/Linux/instrprof-value-merge.c | 6 +- .../Linux/instrprof-vtable-value-prof.cpp | 12 +- .../test/profile/Posix/instrprof-shared.test | 12 +- .../Posix/instrprof-value-prof-shared.test | 30 +- .../Windows/instrprof-multiprocess.test | 2 +- compiler-rt/test/profile/coverage-inline.cpp | 4 +- compiler-rt/test/profile/infinite_loop.c | 2 +- .../instrprof-binary-correlate-debuginfod.c | 2 +- .../test/profile/instrprof-binary-correlate.c | 6 +- .../test/profile/instrprof-timestamp.c | 4 +- .../test/profile/instrprof-value-prof-2.c | 2 +- .../profile/instrprof-value-prof-evict.test | 6 +- .../test/profile/instrprof-value-prof-reset.c | 6 +- .../test/profile/instrprof-value-prof.c | 16 +- .../test/profile/instrprof-value-prof.test | 10 +- compiler-rt/test/profile/runtime_infinite.c | 2 +- llvm/docs/CommandGuide/llvm-profdata.rst | 2 +- llvm/test/CodeGen/X86/fsafdo_probe2.ll | 2 +- llvm/test/CodeGen/X86/fsafdo_test2.ll | 4 +- llvm/test/CodeGen/X86/fsafdo_test3.ll | 4 +- .../PGOProfile/data-access-profile.ll | 4 +- llvm/test/Transforms/PGOProfile/memprof.ll | 4 +- .../memprof_annotate_indirect_call.test | 4 +- .../memprof_max_cold_threshold.test | 2 +- .../Transforms/PGOProfile/suppl-profile.ll | 8 +- .../compressed-profile-symbol-list.ll | 2 +- .../SampleProfile/csspgo-import-list.ll | 4 +- .../Transforms/SampleProfile/csspgo-inline.ll | 2 +- .../SampleProfile/csspgo-use-preinliner.ll | 2 +- .../profile-correlation-irreducible-loops.ll | 2 +- .../SampleProfile/profile-format-compress.ll | 2 +- .../SampleProfile/profile-sample-accurate.ll | 2 +- .../SampleProfile/pseudo-probe-inline.ll | 8 +- .../SampleProfile/pseudo-probe-profile.ll | 2 +- .../pseudo-probe-stale-profile-toplev-func.ll | 2 +- llvm/test/Transforms/SampleProfile/remap.ll | 2 +- .../SampleProfile/remarks-hotness.ll | 4 +- llvm/test/Transforms/SampleProfile/remarks.ll | 4 +- .../uncompressed-profile-symbol-list.ll | 2 +- llvm/test/tools/llvm-profdata/c-general.test | 4 +- llvm/test/tools/llvm-profdata/compat.proftext | 6 +- .../llvm-profdata/count-mismatch.proftext | 2 +- .../cs-sample-nested-profile.test | 20 +- .../llvm-profdata/cs-sample-profile.test | 4 +- .../llvm-profdata/cs-sample-trimmer.test | 8 +- .../test/tools/llvm-profdata/csprof-dump.test | 14 +- llvm/test/tools/llvm-profdata/cutoff.test | 12 +- .../llvm-profdata/forward-compatible.test | 8 +- .../test/tools/llvm-profdata/general.proftext | 8 +- .../llvm-profdata/hash-mismatch.proftext | 2 +- llvm/test/tools/llvm-profdata/help.test | 14 +- llvm/test/tools/llvm-profdata/input-dir.test | 4 +- .../tools/llvm-profdata/input-filenames.test | 4 +- .../tools/llvm-profdata/input-wildcard.test | 2 +- .../test/tools/llvm-profdata/instr-remap.test | 2 +- .../tools/llvm-profdata/invalid-profdata.test | 4 +- .../malformed-num-counters-zero.test | 10 +- .../test/tools/llvm-profdata/mcdc-bitmap.test | 8 +- .../llvm-profdata/memop-size-prof.proftext | 10 +- .../llvm-profdata/memprof-merge-versions.test | 8 +- .../tools/llvm-profdata/memprof-yaml.test | 12 +- .../tools/llvm-profdata/merge-filter.test | 18 +- .../llvm-profdata/merge-incompatible.test | 2 +- .../llvm-profdata/merge-probe-profile.test | 2 +- .../tools/llvm-profdata/merge-traces.proftext | 24 +- .../llvm-profdata/merge_empty_profile.test | 8 +- .../tools/llvm-profdata/multiple-inputs.test | 26 +- .../tools/llvm-profdata/overflow-instr.test | 8 +- .../tools/llvm-profdata/overflow-sample.test | 8 +- llvm/test/tools/llvm-profdata/overlap.test | 4 +- llvm/test/tools/llvm-profdata/overlap_cs.test | 4 +- .../profile-symbol-list-compress.test | 16 +- .../llvm-profdata/profile-symbol-list.test | 20 +- .../tools/llvm-profdata/pseudo_count.test | 24 +- .../tools/llvm-profdata/raw-32-bits-be.test | 4 +- .../tools/llvm-profdata/raw-32-bits-le.test | 4 +- .../tools/llvm-profdata/raw-64-bits-be.test | 4 +- .../tools/llvm-profdata/raw-64-bits-le.test | 4 +- .../tools/llvm-profdata/raw-two-profiles.test | 2 +- .../tools/llvm-profdata/read-traces.proftext | 8 +- .../llvm-profdata/roundtrip-compress.test | 10 +- llvm/test/tools/llvm-profdata/roundtrip.test | 22 +- .../tools/llvm-profdata/same-filename.test | 16 +- .../llvm-profdata/sample-flatten-profile.test | 8 +- llvm/test/tools/llvm-profdata/sample-fs.test | 24 +- .../llvm-profdata/sample-hot-func-list.test | 4 +- .../tools/llvm-profdata/sample-overlap.test | 6 +- .../llvm-profdata/sample-profile-basic.test | 2 +- .../llvm-profdata/sample-profile-json.test | 2 +- .../tools/llvm-profdata/sample-remap.test | 2 +- .../llvm-profdata/sample-split-layout.test | 5 +- .../tools/llvm-profdata/sample-summary.test | 2 +- .../llvm-profdata/show-order-error.proftext | 2 +- .../tools/llvm-profdata/show-order.proftext | 2 +- .../tools/llvm-profdata/show-prof-info.test | 4 +- .../suppl-instr-with-sample-flatten.test | 4 +- .../suppl-instr-with-sample-static-func.test | 16 +- .../suppl-instr-with-sample.test | 36 +- llvm/test/tools/llvm-profdata/text-dump.test | 14 +- .../llvm-profdata/text-format-errors.test | 2 +- .../tools/llvm-profdata/trace-limit.proftext | 10 +- .../tools/llvm-profdata/value-prof.proftext | 6 +- .../llvm-profdata/vtable-value-prof.test | 8 +- .../tools/llvm-profdata/weight-instr.test | 28 +- .../tools/llvm-profdata/weight-sample.test | 22 +- .../llvm-profgen/afdo-with-vtable-pie.test | 2 +- .../tools/llvm-profgen/afdo-with-vtable.test | 2 +- .../test/tools/llvm-profgen/cs-extbinary.test | 8 +- .../test/tools/llvm-profgen/cs-preinline.test | 8 +- .../tools/llvm-profgen/inline-cs-noprobe.test | 2 +- .../tools/llvm-profgen/inline-noprobe2.test | 2 +- .../llvm-profgen/noinline-cs-noprobe.test | 6 +- llvm/tools/llvm-profdata/Opts.td | 295 ++++++++-------- llvm/tools/llvm-profdata/llvm-profdata.cpp | 320 ++++++------------ 127 files changed, 695 insertions(+), 823 deletions(-) diff --git a/bolt/docs/OptimizingClang.md b/bolt/docs/OptimizingClang.md index 9992b4c735c22..a5ce9fdcd134d 100644 --- a/bolt/docs/OptimizingClang.md +++ b/bolt/docs/OptimizingClang.md @@ -258,7 +258,7 @@ Once the build is completed, the profile files will be saved under passed back into Clang: ```bash $ cd ${TOPLEV}/stage2-prof-gen/profiles -$ ${TOPLEV}/stage1/install/bin/llvm-profdata merge -output=clang.profdata * +$ ${TOPLEV}/stage1/install/bin/llvm-profdata merge --output=clang.profdata * ``` ### Building Clang with PGO and LTO diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst index 395f2bcc85ef0..5d4952f67d774 100644 --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -156,7 +156,7 @@ coverage reports. This is done using the "merge" tool in ``llvm-profdata`` .. code-block:: console # Step 3(a): Index the raw profile. - % llvm-profdata merge -sparse foo.profraw -o foo.profdata + % llvm-profdata merge --sparse foo.profraw -o foo.profdata For an example of merging multiple profiles created by testing, see the LLVM `coverage build script `_. @@ -261,7 +261,7 @@ A few final notes: .. code-block:: console - % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata + % llvm-profdata merge --sparse foo1.profraw foo2.profdata -o foo3.profdata Exporting coverage data ======================= diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 023e9a3c58834..412de42965ab5 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -3239,7 +3239,7 @@ instrumentation: .. code-block:: console - $ llvm-profdata merge -output=code.profdata code-*.profraw + $ llvm-profdata merge --output=code.profdata code-*.profraw Note that this step is necessary even when there is only one "raw" profile, since the merge operation also changes the file format. @@ -3284,7 +3284,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. .. code-block:: console - $ llvm-profdata merge -output=code.profdata yyy/zzz/ + $ llvm-profdata merge --output=code.profdata yyy/zzz/ If the user wants to turn off the auto-merging feature, or simply override the the profile dumping path specified at command line, the environment variable @@ -3309,7 +3309,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. $ clang++ -O2 -fprofile-generate=yyy/zzz code.cc -o code $ ./code - $ llvm-profdata merge -output=code.profdata yyy/zzz/ + $ llvm-profdata merge --output=code.profdata yyy/zzz/ The first few steps are the same as that in ``-fprofile-generate`` compilation. Then perform a second round of instrumentation. @@ -3319,7 +3319,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. $ clang++ -O2 -fprofile-use=code.profdata -fcs-profile-generate=sss/ttt \ -o cs_code $ ./cs_code - $ llvm-profdata merge -output=cs_code.profdata sss/ttt code.profdata + $ llvm-profdata merge --output=cs_code.profdata sss/ttt code.profdata The resulted ``cs_code.prodata`` combines ``code.profdata`` and the profile generated from binary ``cs_code``. Profile ``cs_code.profata`` can be used by @@ -3625,7 +3625,7 @@ instrument functions in a specified group. This can be done using the .. code-block:: console - $ llvm-profdata merge -output=code.profdata group_*/*.profraw + $ llvm-profdata merge --output=code.profdata group_*/*.profraw Profile remapping diff --git a/clang/test/CodeGenCXX/profile-remap.cpp b/clang/test/CodeGenCXX/profile-remap.cpp index 748c58d91d105..606930e66ea95 100644 --- a/clang/test/CodeGenCXX/profile-remap.cpp +++ b/clang/test/CodeGenCXX/profile-remap.cpp @@ -1,9 +1,9 @@ // REQUIRES: x86-registered-target // // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-sample-use=%S/Inputs/profile-remap.samples -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SAMPLES -// RUN: llvm-profdata merge -output %t.profdata %S/Inputs/profile-remap.proftext +// RUN: llvm-profdata merge --output %t.profdata %S/Inputs/profile-remap.proftext // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t.profdata -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-INSTR -// RUN: llvm-profdata merge -output %t.profdata %S/Inputs/profile-remap_entry.proftext +// RUN: llvm-profdata merge --output %t.profdata %S/Inputs/profile-remap_entry.proftext // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t.profdata -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-INSTR namespace Foo { diff --git a/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c b/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c index 0c7e96182aebf..8d6e1c8b49163 100644 --- a/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c +++ b/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c @@ -9,7 +9,7 @@ // RUN: llvm-profdata merge \ // RUN: %S/Inputs/optimization-remark-with-hotness.proftext \ // RUN: -o %t.profdata -// RUN: llvm-profdata merge -sample \ +// RUN: llvm-profdata merge --sample \ // RUN: %S/Inputs/optimization-remark-with-hotness-sample.proftext \ // RUN: -o %t-sample.profdata // diff --git a/clang/test/Profile/cxx-hash-v2.cpp b/clang/test/Profile/cxx-hash-v2.cpp index 53097228ba521..14a51e890ac57 100644 --- a/clang/test/Profile/cxx-hash-v2.cpp +++ b/clang/test/Profile/cxx-hash-v2.cpp @@ -1,7 +1,7 @@ // Check that all of the hashes in this file are unique (i.e, that none of the // profiles for these functions are mutually interchangeable). // -// RUN: llvm-profdata show -all-functions %S/Inputs/cxx-hash-v2.profdata.v5 | grep "Hash: 0x" | sort > %t.hashes +// RUN: llvm-profdata show --all-functions %S/Inputs/cxx-hash-v2.profdata.v5 | grep "Hash: 0x" | sort > %t.hashes // RUN: uniq %t.hashes > %t.hashes.unique // RUN: diff %t.hashes %t.hashes.unique diff --git a/compiler-rt/test/profile/ContinuousSyncMode/multi-threaded.cpp b/compiler-rt/test/profile/ContinuousSyncMode/multi-threaded.cpp index 7387f47c13edb..003e8281b3207 100644 --- a/compiler-rt/test/profile/ContinuousSyncMode/multi-threaded.cpp +++ b/compiler-rt/test/profile/ContinuousSyncMode/multi-threaded.cpp @@ -3,7 +3,7 @@ // RUN: rm -rf %t.dir // RUN: %clangxx_pgogen=%t.dir -fprofile-continuous -lpthread %s -o %t.exe -mllvm -disable-vp -fprofile-update=atomic // RUN: %run %t.exe -// RUN: llvm-profdata show --counts --function=accum %t.dir/default_*.profraw | FileCheck %s +// RUN: llvm-profdata show --counts --function accum %t.dir/default_*.profraw | FileCheck %s // CHECK: Block counts: [100000, 4] #include diff --git a/compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c b/compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c index 1e9bd11d3f49c..5d2f232328338 100644 --- a/compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c +++ b/compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c @@ -1,7 +1,7 @@ // Value profiling is currently not supported in lightweight mode. // RUN: %clang_pgogen -o %t -g -mllvm --profile-correlate=debug-info -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.proflite %run %t -// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t.dSYM %t.proflite +// RUN: llvm-profdata merge -o %t.profdata --debug-info %t.dSYM %t.proflite // RUN: %clang_pgogen -o %t.normal -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.normal @@ -13,7 +13,7 @@ // RUN: %clang_pgogen -o %t.cov -g -mllvm --profile-correlate=debug-info -mllvm -pgo-function-entry-coverage -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.cov.proflite %run %t.cov -// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info=%t.cov.dSYM %t.cov.proflite +// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info %t.cov.dSYM %t.cov.proflite // RUN: %clang_pgogen -o %t.cov.normal -mllvm --pgo-function-entry-coverage -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.cov.profraw %run %t.cov.normal @@ -32,7 +32,7 @@ // RUN: rm -rf %t.profdir && mkdir %t.profdir // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.proflite %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.proflite %run %t -// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t.dSYM %t.profdir/ +// RUN: llvm-profdata merge -o %t.profdata --debug-info %t.dSYM %t.profdir/ // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal.functions // RUN: llvm-profdata show --all-functions --counts %t.profdata > %t.functions @@ -41,7 +41,7 @@ // RUN: rm -rf %t.profdir && mkdir %t.profdir // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov -// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info=%t.cov.dSYM %t.profdir/ +// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info %t.cov.dSYM %t.profdir/ // RUN: llvm-profdata show --all-functions --counts %t.cov.normal.profdata > %t.cov.normal.functions // RUN: llvm-profdata show --all-functions --counts %t.cov.profdata > %t.cov.functions diff --git a/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate-warnings.ll b/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate-warnings.ll index 7a8569975c82b..ea2d0f5eaa9c8 100644 --- a/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate-warnings.ll +++ b/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate-warnings.ll @@ -1,7 +1,7 @@ ; RUN: split-file %s %t ; RUN: %clang %t/a.ll -o %t/a.out -; RUN: llvm-profdata merge --debug-info=%t/a.out %t/a.proftext --max-debug-info-correlation-warnings=2 -o %t/a.profdata 2>&1 | FileCheck %s --implicit-check-not=warning --check-prefixes=CHECK,LIMIT -; RUN: llvm-profdata merge --debug-info=%t/a.out %t/a.proftext --max-debug-info-correlation-warnings=0 -o %t/a.profdata 2>&1 | FileCheck %s --implicit-check-not=warning --check-prefixes=CHECK,NOLIMIT +; RUN: llvm-profdata merge --debug-info %t/a.out %t/a.proftext --max-debug-info-correlation-warnings 2 -o %t/a.profdata 2>&1 | FileCheck %s --implicit-check-not=warning --check-prefixes=CHECK,LIMIT +; RUN: llvm-profdata merge --debug-info %t/a.out %t/a.proftext --max-debug-info-correlation-warnings 0 -o %t/a.profdata 2>&1 | FileCheck %s --implicit-check-not=warning --check-prefixes=CHECK,NOLIMIT ; CHECK: warning: Incomplete DIE for function None: ; CHECK: warning: Incomplete DIE for function no_cfg: CFGHash=None diff --git a/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c b/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c index 194f980df9681..5c21d38d08282 100644 --- a/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c +++ b/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c @@ -5,7 +5,7 @@ // RUN: %clang_pgogen -o %t.d4 -g -gdwarf-4 -mllvm --profile-correlate=debug-info -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.d4.proflite %run %t.d4 -// RUN: llvm-profdata merge -o %t.d4.profdata --debug-info=%t.d4 %t.d4.proflite +// RUN: llvm-profdata merge -o %t.d4.profdata --debug-info %t.d4 %t.d4.proflite // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal.dump // RUN: llvm-profdata show --all-functions --counts %t.d4.profdata > %t.d4.dump @@ -13,7 +13,7 @@ // RUN: %clang_pgogen -o %t -g -mllvm --profile-correlate=debug-info -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.proflite %run %t -// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.proflite +// RUN: llvm-profdata merge -o %t.profdata --debug-info %t %t.proflite // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal2.dump // RUN: llvm-profdata show --all-functions --counts %t.profdata > %t.prof.dump @@ -21,7 +21,7 @@ // RUN: %clang_pgogen -o %t.cov -g -mllvm --profile-correlate=debug-info -mllvm -pgo-function-entry-coverage -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.cov.proflite %run %t.cov -// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info=%t.cov %t.cov.proflite +// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info %t.cov %t.cov.proflite // RUN: %clang_pgogen -o %t.cov.normal -mllvm --pgo-function-entry-coverage -mllvm --disable-vp=true %S/../Inputs/instrprof-debug-info-correlate-main.cpp %S/../Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t.cov.profraw %run %t.cov.normal @@ -40,7 +40,7 @@ // RUN: rm -rf %t.profdir && mkdir %t.profdir // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.proflite %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.proflite %run %t -// RUN: llvm-profdata merge -o %t.profdata --debug-info=%t %t.profdir/ +// RUN: llvm-profdata merge -o %t.profdata --debug-info %t %t.profdir/ // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal3.dump // RUN: llvm-profdata show --all-functions --counts %t.profdata > %t.prof3.dump @@ -49,7 +49,7 @@ // RUN: rm -rf %t.profdir && mkdir %t.profdir // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m.cov.proflite %run %t.cov -// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info=%t.cov %t.profdir/ +// RUN: llvm-profdata merge -o %t.cov.profdata --debug-info %t.cov %t.profdir/ // RUN: llvm-profdata show --all-functions --counts %t.cov.normal.profdata > %t.cov.normal2.dump // RUN: llvm-profdata show --all-functions --counts %t.cov.profdata > %t.cov2.dump diff --git a/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test b/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test index 10650a345ab4b..7f719cfe2111d 100644 --- a/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test +++ b/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test @@ -29,15 +29,15 @@ // RUN: llvm-profdata merge main.profraw -o main.profdata // The function counters are not scaled up. -// RUN: llvm-profdata show -all-functions -counts main.profdata | FileCheck %s --check-prefix=INSTR +// RUN: llvm-profdata show --all-functions --counts main.profdata | FileCheck %s --check-prefix=INSTR // The instrPGO profile counter of function foo should be scaled up. Note the // scaling factor of a function is computed based on instrPGO profiles and // invariant to samplePGO profile counters. -// RUN: llvm-profdata merge -supplement-instr-with-sample=sampleprof.proftext \ -// RUN: -suppl-min-size-threshold=0 -instr-prof-cold-threshold=1 \ +// RUN: llvm-profdata merge --supplement-instr-with-sample sampleprof.proftext \ +// RUN: --suppl-min-size-threshold 0 --instr-prof-cold-threshold 1 \ // RUN: main.profdata -o merge.profdata -// RUN: llvm-profdata show -all-functions -counts merge.profdata | FileCheck %s --check-prefix=SUPPL +// RUN: llvm-profdata show --all-functions --counts merge.profdata | FileCheck %s --check-prefix=SUPPL // INSTR: Counters: // INSTR: main: diff --git a/compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c b/compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c index 93bf40f98d3ab..a58a1bbabf7c9 100644 --- a/compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c +++ b/compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c @@ -1,9 +1,9 @@ // RUN: %clang_pgogen -o %t -g -mllvm --profile-correlate=debug-info -mllvm --disable-vp=true %s -// RUN: llvm-profdata show --debug-info=%t --detailed-summary --show-prof-sym-list | FileCheck %s -// RUN: llvm-profdata show --debug-info=%t --show-format=yaml | FileCheck %s --match-full-lines --check-prefix YAML +// RUN: llvm-profdata show --debug-info %t --detailed-summary --show-prof-sym-list | FileCheck %s +// RUN: llvm-profdata show --debug-info %t --show-format yaml | FileCheck %s --match-full-lines --check-prefix YAML // RUN: %clang_pgogen -o %t.no.dbg -mllvm --profile-correlate=debug-info -mllvm --disable-vp=true %s -// RUN: not llvm-profdata show --debug-info=%t.no.dbg 2>&1 | FileCheck %s --check-prefix NO-DBG +// RUN: not llvm-profdata show --debug-info %t.no.dbg 2>&1 | FileCheck %s --check-prefix NO-DBG // NO-DBG: unable to correlate profile: could not find any profile data metadata in correlated file // YAML: Probes: diff --git a/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c b/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c index b664eb78734de..740bbb8427afd 100644 --- a/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c +++ b/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c @@ -12,4 +12,4 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c diff --git a/compiler-rt/test/profile/Linux/instrprof-value-merge.c b/compiler-rt/test/profile/Linux/instrprof-value-merge.c index dc239e88c676b..afbc4954c60e8 100644 --- a/compiler-rt/test/profile/Linux/instrprof-value-merge.c +++ b/compiler-rt/test/profile/Linux/instrprof-value-merge.c @@ -7,7 +7,7 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c /// -z start-stop-gc requires binutils 2.37. Don't test the option for now. /// TODO: Add -Wl,--gc-sections. @@ -18,7 +18,7 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c // RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=gold -ffunction-sections -fdata-sections // RUN: rm -rf %t.profdir @@ -27,4 +27,4 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c diff --git a/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp b/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp index e6a4af7b631e9..069050703a361 100644 --- a/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp +++ b/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp @@ -11,23 +11,23 @@ // RUN: env LLVM_PROFILE_FILE=test.profraw ./test // Show vtable profiles from raw profile. -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables test.profraw | FileCheck %s --check-prefixes=COMMON,RAW +// RUN: llvm-profdata show --function main --ic-targets --show-vtables test.profraw | FileCheck %s --check-prefixes=COMMON,RAW // Generate indexed profile from raw profile and show the data. // RUN: llvm-profdata merge --keep-vtable-symbols test.profraw -o test.profdata -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables test.profdata | FileCheck %s --check-prefixes=COMMON,INDEXED +// RUN: llvm-profdata show --function main --ic-targets --show-vtables test.profdata | FileCheck %s --check-prefixes=COMMON,INDEXED // Generate text profile from raw and indexed profiles respectively and show the data. // RUN: llvm-profdata merge --keep-vtable-symbols --text test.profraw -o raw.proftext -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables --text raw.proftext | FileCheck %s --check-prefix=ICTEXT +// RUN: llvm-profdata show --function main --ic-targets --show-vtables --text raw.proftext | FileCheck %s --check-prefix=ICTEXT // RUN: llvm-profdata merge --keep-vtable-symbols --text test.profdata -o indexed.proftext -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables --text indexed.proftext | FileCheck %s --check-prefix=ICTEXT +// RUN: llvm-profdata show --function main --ic-targets --show-vtables --text indexed.proftext | FileCheck %s --check-prefix=ICTEXT // Generate indexed profile from text profiles and show the data // RUN: llvm-profdata merge --keep-vtable-symbols --binary raw.proftext -o text.profraw -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables text.profraw | FileCheck %s --check-prefixes=COMMON,INDEXED +// RUN: llvm-profdata show --function main --ic-targets --show-vtables text.profraw | FileCheck %s --check-prefixes=COMMON,INDEXED // RUN: llvm-profdata merge --keep-vtable-symbols --binary indexed.proftext -o text.profdata -// RUN: llvm-profdata show --function=main --ic-targets --show-vtables text.profdata | FileCheck %s --check-prefixes=COMMON,INDEXED +// RUN: llvm-profdata show --function main --ic-targets --show-vtables text.profdata | FileCheck %s --check-prefixes=COMMON,INDEXED // COMMON: Counters: // COMMON-NEXT: main: diff --git a/compiler-rt/test/profile/Posix/instrprof-shared.test b/compiler-rt/test/profile/Posix/instrprof-shared.test index 7087fa2fa33ed..250635fd6be40 100644 --- a/compiler-rt/test/profile/Posix/instrprof-shared.test +++ b/compiler-rt/test/profile/Posix/instrprof-shared.test @@ -50,12 +50,12 @@ RUN: not llvm-profdata merge -o %t-no-instr1-no-instr1.profdata %t-no-instr1-no- RUN: not llvm-profdata merge -o %t-no-instr2-no-instr1.profdata %t-no-instr2-no-instr1.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-FILE MISSING-FILE: profraw -RUN: llvm-profdata show -counts --function main %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-main-1 -RUN: llvm-profdata show -counts --function main %t-instr-no-instr1.profdata | grep -v 'Total\|Maximum' > %t-main-2 -RUN: llvm-profdata show -counts --function main %t-instr-no-instr2.profdata | grep -v 'Total\|Maximum' > %t-main-3 -RUN: llvm-profdata show -counts --function foo %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-1 -RUN: llvm-profdata show -counts --function foo %t-no-instr1-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-2 -RUN: llvm-profdata show -counts --function foo %t-no-instr2-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-3 +RUN: llvm-profdata show --counts --function main %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-main-1 +RUN: llvm-profdata show --counts --function main %t-instr-no-instr1.profdata | grep -v 'Total\|Maximum' > %t-main-2 +RUN: llvm-profdata show --counts --function main %t-instr-no-instr2.profdata | grep -v 'Total\|Maximum' > %t-main-3 +RUN: llvm-profdata show --counts --function foo %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-1 +RUN: llvm-profdata show --counts --function foo %t-no-instr1-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-2 +RUN: llvm-profdata show --counts --function foo %t-no-instr2-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-3 RUN: %clang_profuse=%t-instr-instr.profdata -o %t-main-instr-instr.ll -S -emit-llvm %S/../Inputs/instrprof-shared-main.c RUN: %clang_profuse=%t-instr-no-instr1.profdata -o %t-main-instr-no-instr1.ll -S -emit-llvm %S/../Inputs/instrprof-shared-main.c diff --git a/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test b/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test index 34abe82952a23..844f5a09b3053 100644 --- a/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test +++ b/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test @@ -3,8 +3,8 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t -rpath %t.d %t.d/t.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.shared -DSHARED_LIB %S/../Inputs/instrprof-value-prof-real.c @@ -12,9 +12,9 @@ // Profile data from shared library will be concatenated to the same raw file. // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.profdata -o %t.ir.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt // Same as above but with profile online merging enabled. @@ -23,11 +23,11 @@ // RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.m.shared -DSHARED_LIB %S/../Inputs/instrprof-value-prof-real.c // RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.m %t.d/t.ir.m.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.m -// RUN: llvm-profdata merge -o %t.ir.m.profdata -dump-input-file-list %t.prof/ | count 2 +// RUN: llvm-profdata merge -o %t.ir.m.profdata --dump-input-file-list %t.prof/ | count 2 // RUN: llvm-profdata merge -o %t.ir.m.profdata %t.prof/ -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.m.profdata -o %t.ir.m.proftxt -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.m.profdata -o %t.ir.m.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.m.proftxt @@ -36,9 +36,9 @@ // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.dyn %t.d/t.ir.dyn.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt // IR level instrumentation: main program uses static counter, shared library uses dynamic memory alloc. @@ -46,7 +46,7 @@ // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.mixed %t.d/t.ir.dyn.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.mixed.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.mixed // RUN: llvm-profdata merge -o %t.ir.mixed.profdata %t.ir.mixed.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.mixed.profdata -o %t.ir.mixed.proftxt -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.mixed.profdata -o %t.ir.mixed.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.mixed.proftxt diff --git a/compiler-rt/test/profile/Windows/instrprof-multiprocess.test b/compiler-rt/test/profile/Windows/instrprof-multiprocess.test index ae5ebd45bec95..d019dc8b0b902 100644 --- a/compiler-rt/test/profile/Windows/instrprof-multiprocess.test +++ b/compiler-rt/test/profile/Windows/instrprof-multiprocess.test @@ -1,7 +1,7 @@ RUN: %clang_profgen %S/Inputs/instrprof-multiprocess.c -o %t RUN: rm -f %t_*.profraw RUN: env LLVM_PROFILE_FILE=%t_%m.profraw %run %t -RUN: llvm-profdata show --counts -function=foo %t_*.profraw | FileCheck %s +RUN: llvm-profdata show --counts --function foo %t_*.profraw | FileCheck %s CHECK: Counters: CHECK: foo: diff --git a/compiler-rt/test/profile/coverage-inline.cpp b/compiler-rt/test/profile/coverage-inline.cpp index a4114363007a3..c47bca79247a1 100644 --- a/compiler-rt/test/profile/coverage-inline.cpp +++ b/compiler-rt/test/profile/coverage-inline.cpp @@ -5,7 +5,7 @@ // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe -// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s // Again, with optimizations and inlining. This tests that we use comdats // correctly. @@ -13,7 +13,7 @@ // RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t2.o %s // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe -// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s // CHECK: {{.*}}foo{{.*}}: // CHECK-NEXT: Hash: diff --git a/compiler-rt/test/profile/infinite_loop.c b/compiler-rt/test/profile/infinite_loop.c index 0e3981c712f6b..dd323b46e5d1c 100644 --- a/compiler-rt/test/profile/infinite_loop.c +++ b/compiler-rt/test/profile/infinite_loop.c @@ -1,6 +1,6 @@ // RUN: %clang_pgogen -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t -// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s +// RUN: llvm-profdata show --function main --counts %t.profraw| FileCheck %s void exit(int); int g; diff --git a/compiler-rt/test/profile/instrprof-binary-correlate-debuginfod.c b/compiler-rt/test/profile/instrprof-binary-correlate-debuginfod.c index 09fb39cc3d076..0890c7b6ddbd8 100644 --- a/compiler-rt/test/profile/instrprof-binary-correlate-debuginfod.c +++ b/compiler-rt/test/profile/instrprof-binary-correlate-debuginfod.c @@ -37,5 +37,5 @@ // MISSING-CORRELATION-KIND: error: Expected --correlate when --debug-file-directory is provided // Test error for llvm-profdata merge profile correlation with mixing correlation options. -// RUN: not llvm-profdata merge -o %t.error.profdata --binary-file=%t.correlate.exe --debug-file-directory %t --correlate=binary %t.correlate.profraw 2>&1 | FileCheck %s --check-prefix=MIXING-FLAGS +// RUN: not llvm-profdata merge -o %t.error.profdata --binary-file %t.correlate.exe --debug-file-directory %t --correlate=binary %t.correlate.profraw 2>&1 | FileCheck %s --check-prefix=MIXING-FLAGS // MIXING-FLAGS: error: Expected only one of -binary-file, -debuginfod or -debug-file-directory diff --git a/compiler-rt/test/profile/instrprof-binary-correlate.c b/compiler-rt/test/profile/instrprof-binary-correlate.c index 0e96745a9b58f..0ad5f4efffed3 100644 --- a/compiler-rt/test/profile/instrprof-binary-correlate.c +++ b/compiler-rt/test/profile/instrprof-binary-correlate.c @@ -9,7 +9,7 @@ // With -profile-correlate=binary flag // RUN: %clang -o %t-1.exe -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp // RUN: env LLVM_PROFILE_FILE=%t-1.profraw %run %t-1.exe -// RUN: llvm-profdata merge -o %t-1.profdata --binary-file=%t-1.exe %t-1.profraw +// RUN: llvm-profdata merge -o %t-1.profdata --binary-file %t-1.exe %t-1.profraw // RUN: llvm-cov report --instr-profile=%t-1.profdata %t-1.exe > %t-1.report // RUN: llvm-cov show --instr-profile=%t-1.profdata %t-1.exe > %t-1.show // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal.profdata.show @@ -21,7 +21,7 @@ // Strip above binary and run // RUN: llvm-strip %t-1.exe -o %t-2.exe // RUN: env LLVM_PROFILE_FILE=%t-2.profraw %run %t-2.exe -// RUN: llvm-profdata merge -o %t-2.profdata --binary-file=%t-1.exe %t-2.profraw +// RUN: llvm-profdata merge -o %t-2.profdata --binary-file %t-1.exe %t-2.profraw // RUN: llvm-cov report --instr-profile=%t-2.profdata %t-1.exe > %t-2.report // RUN: llvm-cov show --instr-profile=%t-2.profdata %t-1.exe > %t-2.show // RUN: llvm-profdata show --all-functions --counts %t-2.profdata > %t-2.profdata.show @@ -39,7 +39,7 @@ // RUN: rm -rf %t.profdir && mkdir %t.profdir // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe -// RUN: llvm-profdata merge -o %t-4.profdata --binary-file=%t-1.exe %t.profdir +// RUN: llvm-profdata merge -o %t-4.profdata --binary-file %t-1.exe %t.profdir // RUN: llvm-cov report --instr-profile=%t-4.profdata %t-1.exe > %t-4.report // RUN: llvm-cov show --instr-profile=%t-4.profdata %t-1.exe > %t-4.show // RUN: llvm-profdata show --all-functions --counts %t.normal.merged.profdata > %t.normal.merged.profdata.show diff --git a/compiler-rt/test/profile/instrprof-timestamp.c b/compiler-rt/test/profile/instrprof-timestamp.c index ad14e6646782c..8b037ef7760cd 100644 --- a/compiler-rt/test/profile/instrprof-timestamp.c +++ b/compiler-rt/test/profile/instrprof-timestamp.c @@ -2,14 +2,14 @@ // RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation %s // RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n // RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y -// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw +// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input 5,%t.1.profraw // RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused // RUN: rm -f %t.profdata // RUN: %clang_pgogen -o %t -mllvm -pgo-temporal-instrumentation -mllvm -pgo-block-coverage %s // RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t n // RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t y -// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input=5,%t.1.profraw +// RUN: llvm-profdata merge -o %t.profdata %t.0.profraw --weighted-input 5,%t.1.profraw // RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --implicit-check-not=unused extern void exit(int); diff --git a/compiler-rt/test/profile/instrprof-value-prof-2.c b/compiler-rt/test/profile/instrprof-value-prof-2.c index abc990ac8b052..a3646ff77b007 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-2.c +++ b/compiler-rt/test/profile/instrprof-value-prof-2.c @@ -1,7 +1,7 @@ // RUN: %clang_profgen -mllvm -enable-value-profiling -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata > %t.out +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata > %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-1 < %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-2 < %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-3 < %t.out diff --git a/compiler-rt/test/profile/instrprof-value-prof-evict.test b/compiler-rt/test/profile/instrprof-value-prof-evict.test index 8b054fb24371e..bfab4fe53babf 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-evict.test +++ b/compiler-rt/test/profile/instrprof-value-prof-evict.test @@ -1,16 +1,16 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t.ir %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c // IR level instrumentation, dynamic allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -o %t.ir.dyn %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c diff --git a/compiler-rt/test/profile/instrprof-value-prof-reset.c b/compiler-rt/test/profile/instrprof-value-prof-reset.c index b3744f5735066..e8bb0b317c1bc 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-reset.c +++ b/compiler-rt/test/profile/instrprof-value-prof-reset.c @@ -1,19 +1,19 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=3 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %s // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=3 -o %t.ir %s // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %s // IR level instrumentation, dynamic allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -o %t.ir.dyn %s // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %s void callee_0() {} void callee_1() {} void callee_2() {} diff --git a/compiler-rt/test/profile/instrprof-value-prof.c b/compiler-rt/test/profile/instrprof-value-prof.c index 3e8203f8182d1..b5a9c254df731 100644 --- a/compiler-rt/test/profile/instrprof-value-prof.c +++ b/compiler-rt/test/profile/instrprof-value-prof.c @@ -4,9 +4,9 @@ // RUN: llvm-profdata merge -o %t.profdata %t.profraw // RUN: llvm-profdata merge -o %t-2.profdata %t-2.profraw // RUN: llvm-profdata merge -o %t-merged.profdata %t.profraw %t-2.profdata -// RUN: llvm-profdata show --all-functions -ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions -ic-targets %t-merged.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-merged.profdata | FileCheck %s // // RUN: env LLVM_PROFILE_FILE=%t-3.profraw LLVM_VP_BUFFER_SIZE=1 %run %t // RUN: env LLVM_PROFILE_FILE=%t-4.profraw LLVM_VP_BUFFER_SIZE=8 %run %t @@ -18,11 +18,11 @@ // RUN: llvm-profdata merge -o %t-5.profdata %t-5.profraw // RUN: llvm-profdata merge -o %t-6.profdata %t-6.profraw // RUN: llvm-profdata merge -o %t-7.profdata %t-7.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t-3.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions -ic-targets %t-4.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions -ic-targets %t-5.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions -ic-targets %t-6.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions -ic-targets %t-7.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-3.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-4.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-5.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-6.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions --ic-targets %t-7.profdata | FileCheck %s #include #include diff --git a/compiler-rt/test/profile/instrprof-value-prof.test b/compiler-rt/test/profile/instrprof-value-prof.test index f85c131e6e4b8..f0e15ed7d4c63 100644 --- a/compiler-rt/test/profile/instrprof-value-prof.test +++ b/compiler-rt/test/profile/instrprof-value-prof.test @@ -2,21 +2,21 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t.ir %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.profdata -o %t.ir.proftxt // RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt // IR level instrumentation with dynamic memory allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -o %t.ir.dyn %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt +// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge --text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt // RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt diff --git a/compiler-rt/test/profile/runtime_infinite.c b/compiler-rt/test/profile/runtime_infinite.c index b55f5e2750dd9..6058dd5f1475f 100644 --- a/compiler-rt/test/profile/runtime_infinite.c +++ b/compiler-rt/test/profile/runtime_infinite.c @@ -6,7 +6,7 @@ // RUN: %clang_pgogen -mllvm -do-counter-promotion=false -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t -// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s +// RUN: llvm-profdata show --function main --counts %t.profraw| FileCheck %s void exit(int); int __llvm_profile_dump(void); diff --git a/llvm/docs/CommandGuide/llvm-profdata.rst b/llvm/docs/CommandGuide/llvm-profdata.rst index 0b1cd02e2230f..8b1dc412444e7 100644 --- a/llvm/docs/CommandGuide/llvm-profdata.rst +++ b/llvm/docs/CommandGuide/llvm-profdata.rst @@ -260,7 +260,7 @@ Merge three profiles: :: - llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata + llvm-profdata merge foo.profdata bar.profdata baz.profdata --output merged.profdata Weighted Input ++++++++++++++ diff --git a/llvm/test/CodeGen/X86/fsafdo_probe2.ll b/llvm/test/CodeGen/X86/fsafdo_probe2.ll index 04e4145abdc0c..618019cf49aff 100644 --- a/llvm/test/CodeGen/X86/fsafdo_probe2.ll +++ b/llvm/test/CodeGen/X86/fsafdo_probe2.ll @@ -1,5 +1,5 @@ ; REQUIRES: asserts -; RUN: llvm-profdata merge --sample -profile-isfs --extbinary -o %t.afdo %S/Inputs/fsloader-probe.afdo +; RUN: llvm-profdata merge --sample --profile-isfs --extbinary -o %t.afdo %S/Inputs/fsloader-probe.afdo ; RUN: llc -enable-fs-discriminator -fs-profile-file=%t.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefix=LOADER ; ;; diff --git a/llvm/test/CodeGen/X86/fsafdo_test2.ll b/llvm/test/CodeGen/X86/fsafdo_test2.ll index fc4c1e87dd285..3a1648d349a86 100644 --- a/llvm/test/CodeGen/X86/fsafdo_test2.ll +++ b/llvm/test/CodeGen/X86/fsafdo_test2.ll @@ -1,9 +1,9 @@ ; REQUIRES: asserts ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false < %s | FileCheck %s --check-prefixes=V0,V01 -; RUN: llvm-profdata merge --sample -profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo +; RUN: llvm-profdata merge --sample --profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false -fs-profile-file=%t0.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV0,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true < %s | FileCheck %s --check-prefixes=V1,V01 -; RUN: llvm-profdata merge --sample -profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo +; RUN: llvm-profdata merge --sample --profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%t1.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV1,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%S/Inputs/fsloader_v1.afdo -profile-isfs -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV1,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%S/Inputs/fsloader_v1.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=NOLOAD diff --git a/llvm/test/CodeGen/X86/fsafdo_test3.ll b/llvm/test/CodeGen/X86/fsafdo_test3.ll index 79b57fe4f1a32..e14f2d0761e86 100644 --- a/llvm/test/CodeGen/X86/fsafdo_test3.ll +++ b/llvm/test/CodeGen/X86/fsafdo_test3.ll @@ -1,6 +1,6 @@ -; RUN: llvm-profdata merge --sample -profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo +; RUN: llvm-profdata merge --sample --profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false -fs-profile-file=%t0.afdo -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false -print-machine-bfi -print-bfi-func-name=foo -print-before=fs-profile-loader -stop-after=fs-profile-loader < %s 2>&1 | FileCheck %s --check-prefixes=BFI,BFIV0 -; RUN: llvm-profdata merge --sample -profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo +; RUN: llvm-profdata merge --sample --profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%t1.afdo -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false -print-machine-bfi -print-bfi-func-name=foo -print-before=fs-profile-loader -stop-after=fs-profile-loader < %s 2>&1 | FileCheck %s --check-prefixes=BFI,BFIV1 ; ;; diff --git a/llvm/test/Transforms/PGOProfile/data-access-profile.ll b/llvm/test/Transforms/PGOProfile/data-access-profile.ll index 7c062a90024ae..25bb2134e7ec4 100644 --- a/llvm/test/Transforms/PGOProfile/data-access-profile.ll +++ b/llvm/test/Transforms/PGOProfile/data-access-profile.ll @@ -4,8 +4,8 @@ ; RUN: rm -rf %t && split-file %s %t && cd %t ;; Read text profiles and merge them into indexed profiles. -; RUN: llvm-profdata merge --memprof-version=4 memprof.yaml -o memprof.profdata -; RUN: llvm-profdata merge --memprof-version=4 memprof-no-dap.yaml -o memprof-no-dap.profdata +; RUN: llvm-profdata merge --memprof-version 4 memprof.yaml -o memprof.profdata +; RUN: llvm-profdata merge --memprof-version 4 memprof-no-dap.yaml -o memprof-no-dap.profdata ;; Run optimizer pass on an IR module without IR functions, and test that global ;; variables in the module could be annotated (i.e., no early return), diff --git a/llvm/test/Transforms/PGOProfile/memprof.ll b/llvm/test/Transforms/PGOProfile/memprof.ll index a1f0f1d403c8f..63fa2ec5907f9 100644 --- a/llvm/test/Transforms/PGOProfile/memprof.ll +++ b/llvm/test/Transforms/PGOProfile/memprof.ll @@ -91,14 +91,14 @@ ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -memprof-cloning-cold-threshold=80 -memprof-keep-all-not-cold-contexts 2>&1 | FileCheck %s --check-prefixes=TOTALSIZES,TOTALSIZESKEEPALL ;; Make sure we emit a random hotness seed if requested. -; RUN: llvm-profdata merge -memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND +; RUN: llvm-profdata merge --memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND ; RAND: random hotness seed = ;; Can't check the exact values, but make sure applying the random profile ;; succeeds with the same stats ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=ALL,MEMPROFONLY,MEMPROFSTATS ;; Make sure we use a specific random hotness seed if requested. -; RUN: llvm-profdata merge -memprof-random-hotness -memprof-random-hotness-seed=1730170724 %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand2 2>&1 | FileCheck %s --check-prefix=RAND2 +; RUN: llvm-profdata merge --memprof-random-hotness --memprof-random-hotness-seed 1730170724 %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand2 2>&1 | FileCheck %s --check-prefix=RAND2 ; RAND2: random hotness seed = 1730170724 ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=MEMPROFRAND2,ALL,MEMPROFONLY,MEMPROFSTATS diff --git a/llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call.test b/llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call.test index 4677eebff3cfe..f1cfdf23e2754 100644 --- a/llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call.test +++ b/llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call.test @@ -1,12 +1,12 @@ ; RUN: split-file %s %t ;; Basic functionality with flag toggle -; RUN: llvm-profdata merge --memprof-version=4 %t/basic.yaml -o %t/basic.memprofdata +; RUN: llvm-profdata merge --memprof-version 4 %t/basic.yaml -o %t/basic.memprofdata ; RUN: opt < %t/basic.ll -passes='memprof-use' -memprof-attach-calleeguids=false -S 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLE ; RUN: opt < %t/basic.ll -passes='memprof-use' -memprof-attach-calleeguids=true -S 2>&1 | FileCheck %s --check-prefix=CHECK-ENABLE --dump-input-filter=all ;; FDO conflict handling -; RUN: llvm-profdata merge --memprof-version=4 %t/fdo_conflict.yaml -o %t/fdo_conflict.memprofdata +; RUN: llvm-profdata merge --memprof-version 4 %t/fdo_conflict.yaml -o %t/fdo_conflict.memprofdata ; RUN: opt < %t/fdo_conflict.ll -passes='memprof-use' -memprof-attach-calleeguids=true -S 2>&1 | FileCheck %s --check-prefix=CHECK-FDO ;--- basic.yaml diff --git a/llvm/test/Transforms/PGOProfile/memprof_max_cold_threshold.test b/llvm/test/Transforms/PGOProfile/memprof_max_cold_threshold.test index 8f1cabf9a4e87..2d803bae363ca 100644 --- a/llvm/test/Transforms/PGOProfile/memprof_max_cold_threshold.test +++ b/llvm/test/Transforms/PGOProfile/memprof_max_cold_threshold.test @@ -6,7 +6,7 @@ ; RUN: split-file %s %t ;; Specify version 4 so that a summary is generated. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof_max_cold_threshold.yaml -o %t/memprof_max_cold_threshold.memprofdata +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof_max_cold_threshold.yaml -o %t/memprof_max_cold_threshold.memprofdata ; RUN: llvm-profdata show --memory %t/memprof_max_cold_threshold.memprofdata | FileCheck %s --check-prefixes=SUMMARY ; SUMMARY: # MemProfSummary: diff --git a/llvm/test/Transforms/PGOProfile/suppl-profile.ll b/llvm/test/Transforms/PGOProfile/suppl-profile.ll index 9e00ceec92b99..175b565ef06e3 100644 --- a/llvm/test/Transforms/PGOProfile/suppl-profile.ll +++ b/llvm/test/Transforms/PGOProfile/suppl-profile.ll @@ -1,13 +1,13 @@ ; Supplement instr profile suppl-profile.proftext with sample profile ; sample-profile.proftext. ; For hot functions: -; RUN: llvm-profdata merge -instr -suppl-min-size-threshold=0 \ -; RUN: -supplement-instr-with-sample=%p/Inputs/sample-profile-hot.proftext \ +; RUN: llvm-profdata merge --instr --suppl-min-size-threshold 0 \ +; RUN: --supplement-instr-with-sample %p/Inputs/sample-profile-hot.proftext \ ; RUN: %S/Inputs/suppl-profile.proftext -o %t.profdata ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=HOT ; For warm functions: -; RUN: llvm-profdata merge -instr -suppl-min-size-threshold=0 \ -; RUN: -supplement-instr-with-sample=%p/Inputs/sample-profile-warm.proftext \ +; RUN: llvm-profdata merge --instr --suppl-min-size-threshold 0 \ +; RUN: --supplement-instr-with-sample %p/Inputs/sample-profile-warm.proftext \ ; RUN: %S/Inputs/suppl-profile.proftext -o %t1.profdata ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t1.profdata -S | FileCheck %s --check-prefix=WARM diff --git a/llvm/test/Transforms/SampleProfile/compressed-profile-symbol-list.ll b/llvm/test/Transforms/SampleProfile/compressed-profile-symbol-list.ll index 016016fc5063e..2bdce84f36467 100644 --- a/llvm/test/Transforms/SampleProfile/compressed-profile-symbol-list.ll +++ b/llvm/test/Transforms/SampleProfile/compressed-profile-symbol-list.ll @@ -1,4 +1,4 @@ ; REQUIRES: zlib ; Append inline.prof with profile symbol list and save it after compression. -; RUN: llvm-profdata merge --sample --prof-sym-list=%S/Inputs/profile-symbol-list.text --compress-all-sections=true --extbinary %S/Inputs/inline.prof --output=%t.profdata +; RUN: llvm-profdata merge --sample --prof-sym-list %S/Inputs/profile-symbol-list.text --compress-all-sections --extbinary %S/Inputs/inline.prof -o %t.profdata ; RUN: opt < %S/Inputs/profile-symbol-list.ll -passes=sample-profile -profile-accurate-for-symsinlist -sample-profile-file=%t.profdata -S | FileCheck %S/Inputs/profile-symbol-list.ll diff --git a/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll b/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll index ade2d73fb4684..35a529856f20e 100644 --- a/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll +++ b/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll @@ -2,10 +2,10 @@ ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%S/Inputs/csspgo-import-list.prof --sample-profile-even-flow-distribution=0 -S | FileCheck %s ; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/csspgo-import-list.prof -o %t.prof ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.prof --sample-profile-even-flow-distribution=0 -S | FileCheck %s -; RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s --check-prefix=CHECK-ORDERED +; RUN: llvm-profdata show --sample --show-sec-info-only %t.prof | FileCheck %s --check-prefix=CHECK-ORDERED ; RUN: llvm-profdata merge --sample --extbinary --use-md5 %S/Inputs/csspgo-import-list.prof -o %t.md5 ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.md5 --sample-profile-even-flow-distribution=0 -S | FileCheck %s -; RUN: llvm-profdata show --sample -show-sec-info-only %t.md5 | FileCheck %s --check-prefix=CHECK-ORDERED +; RUN: llvm-profdata show --sample --show-sec-info-only %t.md5 | FileCheck %s --check-prefix=CHECK-ORDERED ;; Validate that with replay in effect, we import call sites even if they are below the threshold ;; Baseline import decisions diff --git a/llvm/test/Transforms/SampleProfile/csspgo-inline.ll b/llvm/test/Transforms/SampleProfile/csspgo-inline.ll index deabc275d99c9..8b5f6db0d3ff0 100644 --- a/llvm/test/Transforms/SampleProfile/csspgo-inline.ll +++ b/llvm/test/Transforms/SampleProfile/csspgo-inline.ll @@ -10,7 +10,7 @@ ; RUN: llvm-profdata merge --sample --extbinary --use-md5 %S/Inputs/profile-context-tracker.prof -o %t.md5 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.md5 -sample-profile-inline-size -sample-profile-prioritized-inline=0 -profile-sample-accurate -S -pass-remarks=inline -o /dev/null 2>&1 | FileCheck %s --check-prefix=INLINE-BASE -; RUN: llvm-profdata merge --sample --text --convert-sample-profile-layout=nest %S/Inputs/profile-context-tracker.prof -o %t.prof +; RUN: llvm-profdata merge --sample --text --convert-sample-profile-layout nest %S/Inputs/profile-context-tracker.prof -o %t.prof ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.prof -sample-profile-inline-size -sample-profile-prioritized-inline=0 -profile-sample-accurate -S -pass-remarks=inline -o /dev/null 2>&1 | FileCheck %s --check-prefix=INLINE-BASE ; With new FDO early inliner, callee entry count is used to drive inlining instead of callee total samples, so we get less inlining for given profile diff --git a/llvm/test/Transforms/SampleProfile/csspgo-use-preinliner.ll b/llvm/test/Transforms/SampleProfile/csspgo-use-preinliner.ll index e4ee93970d6f7..f197d255e499d 100644 --- a/llvm/test/Transforms/SampleProfile/csspgo-use-preinliner.ll +++ b/llvm/test/Transforms/SampleProfile/csspgo-use-preinliner.ll @@ -3,7 +3,7 @@ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/csspgo-use-preinliner.prof -pass-remarks=inline -sample-profile-prioritized-inline -profile-sample-accurate -sample-profile-use-preinliner=0 -S 2>&1 | FileCheck %s --check-prefix=DEFAULT ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/csspgo-use-preinliner.prof -pass-remarks=inline -sample-profile-prioritized-inline -profile-sample-accurate -sample-profile-use-preinliner=1 -S 2>&1 | FileCheck %s --check-prefix=PREINLINE -; RUN: llvm-profdata merge --sample --text --convert-sample-profile-layout=nest -generate-merged-base-profiles=0 %S/Inputs/csspgo-use-preinliner.prof -o %t.prof +; RUN: llvm-profdata merge --sample --text --convert-sample-profile-layout nest %S/Inputs/csspgo-use-preinliner.prof -o %t.prof ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.prof -pass-remarks=inline -sample-profile-prioritized-inline -profile-sample-accurate -sample-profile-use-preinliner=0 -S 2>&1 | FileCheck %s --check-prefix=DEFAULT ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.prof -pass-remarks=inline -sample-profile-prioritized-inline -profile-sample-accurate -sample-profile-use-preinliner=1 -S 2>&1 | FileCheck %s --check-prefix=PREINLINE diff --git a/llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll b/llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll index ef2fcc6a9e248..7ee030b42cbc9 100644 --- a/llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll +++ b/llvm/test/Transforms/SampleProfile/profile-correlation-irreducible-loops.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -sample-profile-use-profi=0 | opt -passes='print' -disable-output -use-iterative-bfi-inference 2>&1 | FileCheck %s +; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -sample-profile-use-profi=0 | opt -passes='print' -disable-output -use-iterative-bfi-inference 2>&1 | FileCheck %s ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profile-correlation-irreducible-loops.prof -sample-profile-use-profi=0 -S | FileCheck %s --check-prefix=CHECK2 ; RUN: opt < %s -passes='print' -use-iterative-bfi-inference -disable-output 2>&1 | FileCheck %s --check-prefix=CHECK3 diff --git a/llvm/test/Transforms/SampleProfile/profile-format-compress.ll b/llvm/test/Transforms/SampleProfile/profile-format-compress.ll index 112da585d90b3..28f9280123259 100644 --- a/llvm/test/Transforms/SampleProfile/profile-format-compress.ll +++ b/llvm/test/Transforms/SampleProfile/profile-format-compress.ll @@ -1,6 +1,6 @@ ; REQUIRES: zlib ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof -S | FileCheck %s -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections %S/Inputs/inline.prof -o %t.compress.extbinary.afdo +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections %S/Inputs/inline.prof -o %t.compress.extbinary.afdo ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.compress.extbinary.afdo -S | FileCheck %s ; Original C++ test case diff --git a/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll b/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll index 71defe66395cb..2cf113a61dae3 100644 --- a/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll +++ b/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profsampleacc.extbinary.afdo -profile-summary-cutoff-hot=900000 -profile-sample-accurate -S | FileCheck %s --check-prefix=CALL_SUM_IS_HOT -; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list=%S/Inputs/profile-symbol-list.text %S/Inputs/profsampleacc.extbinary.afdo -o %t.symlist.afdo +; RUN: llvm-profdata merge --sample --extbinary --prof-sym-list %S/Inputs/profile-symbol-list.text %S/Inputs/profsampleacc.extbinary.afdo -o %t.symlist.afdo ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-summary-cutoff-hot=600000 -profile-accurate-for-symsinlist -S | FileCheck %s --check-prefix=PROFSYMLIST ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-accurate-for-symsinlist -profile-symbol-list-cutoff=2 -S | FileCheck %s --check-prefix=PSLCUTOFF2 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-accurate-for-symsinlist -profile-symbol-list-cutoff=3 -S | FileCheck %s --check-prefix=PSLCUTOFF3 diff --git a/llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll b/llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll index b4083f26d9912..7b427ddfa345c 100644 --- a/llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll +++ b/llvm/test/Transforms/SampleProfile/pseudo-probe-inline.ll @@ -1,14 +1,14 @@ -; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-inline.prof -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-inline.prof -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output %t.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE < %t.opt.yaml ; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/pseudo-probe-inline.prof -o %t2 -; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%t2 -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=%t2.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%t2 -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output %t2.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE < %t2.opt.yaml -; RUN: opt < %s -passes=pseudo-probe,sample-profile -annotate-sample-profile-inline-phase=true -sample-profile-file=%S/Inputs/pseudo-probe-inline.prof -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=%t3.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=pseudo-probe,sample-profile -annotate-sample-profile-inline-phase=true -sample-profile-file=%S/Inputs/pseudo-probe-inline.prof -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output %t3.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE < %t3.opt.yaml -; RUN: opt < %s -passes=pseudo-probe,sample-profile -annotate-sample-profile-inline-phase=true -sample-profile-file=%t2 -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output=%t4.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=pseudo-probe,sample-profile -annotate-sample-profile-inline-phase=true -sample-profile-file=%t2 -S -pass-remarks=sample-profile -sample-profile-prioritized-inline=0 -pass-remarks-output %t4.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE < %t4.opt.yaml @factor = dso_local global i32 3, align 4 diff --git a/llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll b/llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll index 66dbc49a1d210..ed98fd1697935 100644 --- a/llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll +++ b/llvm/test/Transforms/SampleProfile/pseudo-probe-profile.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile.prof -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml -sample-profile-use-profi=0 -S -o %t +; RUN: opt < %s -passes=pseudo-probe,sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile.prof -pass-remarks=sample-profile -pass-remarks-output %t.opt.yaml -sample-profile-use-profi=0 -S -o %t ; RUN: FileCheck %s --input-file %t ; RUN: FileCheck %s -check-prefix=YAML --input-file %t.opt.yaml ; RUN: opt < %t -passes=sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-profile.prof -sample-profile-remove-probe -S | FileCheck %s -check-prefix=REMOVE-PROBE diff --git a/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll b/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll index 15a19477f7509..1c6d8501d317a 100644 --- a/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll +++ b/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll @@ -1,6 +1,6 @@ ; REQUIRES: asserts && x86-registered-target ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-stale-profile-toplev-func.prof --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching 2>&1 | FileCheck %s -check-prefix=CHECK-TEXT -; RUN: llvm-profdata merge --sample %S/Inputs/pseudo-probe-stale-profile-toplev-func.prof -extbinary -o %t.extbinary +; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/pseudo-probe-stale-profile-toplev-func.prof -o %t.extbinary ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.extbinary --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching 2>&1 | FileCheck %s -check-prefix=CHECK-EXTBIN ; CHECK-TEXT: Run stale profile matching for main diff --git a/llvm/test/Transforms/SampleProfile/remap.ll b/llvm/test/Transforms/SampleProfile/remap.ll index ffb57e23a735c..c883e6c517e81 100644 --- a/llvm/test/Transforms/SampleProfile/remap.ll +++ b/llvm/test/Transforms/SampleProfile/remap.ll @@ -1,7 +1,7 @@ ; RUN: opt %s -passes=sample-profile -sample-profile-file=%S/Inputs/remap.prof -sample-profile-remapping-file=%S/Inputs/remap.map | opt -passes='print' -disable-output 2>&1 | FileCheck %s ; ; Check whether profile remapping work with loading profile on demand used by extbinary format profile. -; RUN: llvm-profdata merge -sample -extbinary %S/Inputs/remap.prof -o %t.extbinary.afdo +; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/remap.prof -o %t.extbinary.afdo ; RUN: opt %s -passes=sample-profile -sample-profile-file=%t.extbinary.afdo -sample-profile-remapping-file=%S/Inputs/remap.map | opt -passes='print' -disable-output 2>&1 | FileCheck %s ; ; Reduced from branch.ll diff --git a/llvm/test/Transforms/SampleProfile/remarks-hotness.ll b/llvm/test/Transforms/SampleProfile/remarks-hotness.ll index 36fb3c5818170..4b544cab578e1 100644 --- a/llvm/test/Transforms/SampleProfile/remarks-hotness.ll +++ b/llvm/test/Transforms/SampleProfile/remarks-hotness.ll @@ -4,7 +4,7 @@ ; RUN: rm -f %t.yaml %t.hot.yaml ; RUN: opt %s --passes='sample-profile,cgscc(inline)' \ ; RUN: --sample-profile-file=%S/Inputs/remarks-hotness.prof \ -; RUN: -S --pass-remarks-filter=inline --pass-remarks-output=%t.yaml \ +; RUN: -S --pass-remarks-filter=inline --pass-remarks-output %t.yaml \ ; RUN: -pass-remarks-with-hotness --disable-output ; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.yaml ; RUN: FileCheck %s -check-prefix=YAML-MISS < %t.yaml @@ -12,7 +12,7 @@ ;; test 'auto' threshold ; RUN: opt %s --passes='sample-profile,cgscc(inline)' \ ; RUN: --sample-profile-file=%S/Inputs/remarks-hotness.prof \ -; RUN: -S --pass-remarks-filter=inline --pass-remarks-output=%t.hot.yaml \ +; RUN: -S --pass-remarks-filter=inline --pass-remarks-output %t.hot.yaml \ ; RUN: --pass-remarks-with-hotness --pass-remarks-hotness-threshold=auto --disable-output ; RUN: FileCheck %s -check-prefix=YAML-PASS < %t.hot.yaml ; RUN: not FileCheck %s -check-prefix=YAML-MISS < %t.hot.yaml diff --git a/llvm/test/Transforms/SampleProfile/remarks.ll b/llvm/test/Transforms/SampleProfile/remarks.ll index decf4b1aadbd9..493afafa2ed06 100644 --- a/llvm/test/Transforms/SampleProfile/remarks.ll +++ b/llvm/test/Transforms/SampleProfile/remarks.ll @@ -1,7 +1,7 @@ -; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output %t.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-NO-ANNOTATE < %t.opt.yaml -; RUN: opt < %s -passes=sample-profile -annotate-sample-profile-inline-phase -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output=%t.opt.yaml 2>&1 | FileCheck %s +; RUN: opt < %s -passes=sample-profile -annotate-sample-profile-inline-phase -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile -pass-remarks-output %t.opt.yaml 2>&1 | FileCheck %s ; RUN: FileCheck %s -check-prefixes=YAML,YAML-ANNOTATE < %t.opt.yaml ; Original test case. diff --git a/llvm/test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll b/llvm/test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll index 66bd22522fe8c..47b373b0ffbb9 100644 --- a/llvm/test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll +++ b/llvm/test/Transforms/SampleProfile/uncompressed-profile-symbol-list.ll @@ -1,3 +1,3 @@ ; Append inline.prof with profile symbol list and save it without compression. -; RUN: llvm-profdata merge --sample --prof-sym-list=%S/Inputs/profile-symbol-list.text --compress-all-sections=false --extbinary %S/Inputs/inline.prof --output=%t.profdata +; RUN: llvm-profdata merge --sample --prof-sym-list %S/Inputs/profile-symbol-list.text --extbinary %S/Inputs/inline.prof -o %t.profdata ; RUN: opt < %S/Inputs/profile-symbol-list.ll -passes=sample-profile -profile-accurate-for-symsinlist -sample-profile-file=%t.profdata -S | FileCheck %S/Inputs/profile-symbol-list.ll diff --git a/llvm/test/tools/llvm-profdata/c-general.test b/llvm/test/tools/llvm-profdata/c-general.test index ab4849fac034f..0aa6a104201c5 100644 --- a/llvm/test/tools/llvm-profdata/c-general.test +++ b/llvm/test/tools/llvm-profdata/c-general.test @@ -9,8 +9,8 @@ $ clang -o a.out -fprofile-instr-generate $CFE_TESTDIR/c-general.c -mllvm -enabl $ LLVM_PROFILE_FILE=$TESTDIR/Inputs/c-general.profraw ./a.out RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - | FileCheck %s -RUN: llvm-profdata show %p/Inputs/c-general.profraw --topn=3 -o - | FileCheck %s --check-prefix=TOPN -RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - --function=switches | FileCheck %s -check-prefixes=SWITCHES,CHECK +RUN: llvm-profdata show %p/Inputs/c-general.profraw --topn 3 -o - | FileCheck %s --check-prefix=TOPN +RUN: llvm-profdata show %p/Inputs/c-general.profraw -o - --function switches | FileCheck %s -check-prefixes=SWITCHES,CHECK SWITCHES-LABEL: Counters: SWITCHES-NEXT: switches: diff --git a/llvm/test/tools/llvm-profdata/compat.proftext b/llvm/test/tools/llvm-profdata/compat.proftext index 111fd41988197..0879a33150f22 100644 --- a/llvm/test/tools/llvm-profdata/compat.proftext +++ b/llvm/test/tools/llvm-profdata/compat.proftext @@ -46,7 +46,7 @@ large_numbers # SUMMARY: Maximum function count: 2305843009213693952 # SUMMARY: Maximum internal block count: 1152921504606846976 -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v2 -all-functions --counts | FileCheck %s -check-prefix=FORMATV2 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v2 --all-functions --counts | FileCheck %s -check-prefix=FORMATV2 # FORMATV2: Counters: # FORMATV2-NEXT: foo: @@ -65,7 +65,7 @@ large_numbers # FORMATV2-NEXT: Maximum function count: 499500 # FORMATV2-NEXT: Maximum internal block count: 1000000 # -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 -all-functions --counts | FileCheck %s -check-prefix=FORMATV4 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 --all-functions --counts | FileCheck %s -check-prefix=FORMATV4 # FORMATV4: Counters: # FORMATV4: name with spaces: @@ -88,7 +88,7 @@ large_numbers # FORMATV4: Maximum function count: 2305843009213693952 # FORMATV4: Maximum internal block count: 1152921504606846976 -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v10 -all-functions --counts | FileCheck %s -check-prefix=FORMATV10 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v10 --all-functions --counts | FileCheck %s -check-prefix=FORMATV10 # FORMATV10: Counters: # FORMATV10: large_numbers: diff --git a/llvm/test/tools/llvm-profdata/count-mismatch.proftext b/llvm/test/tools/llvm-profdata/count-mismatch.proftext index c4ac2f7866d19..13bb29225b2e1 100644 --- a/llvm/test/tools/llvm-profdata/count-mismatch.proftext +++ b/llvm/test/tools/llvm-profdata/count-mismatch.proftext @@ -2,7 +2,7 @@ # name and a matching hash if the number of counters differs # RUN: llvm-profdata merge %s -o %t.profdata 2>&1 | FileCheck -check-prefix=MERGE_ERRS %s -# RUN: llvm-profdata show %t.profdata -all-functions -counts > %t.out +# RUN: llvm-profdata show %t.profdata --all-functions --counts > %t.out # RUN: FileCheck %s -input-file %t.out foo 1024 diff --git a/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test b/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test index d2b07cf05fd24..12855cf17d06e 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test @@ -1,17 +1,17 @@ -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0 +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest RUN: FileCheck %s < %t.proftext --match-full-lines --strict-whitespace -RUN: llvm-profdata merge --sample --text -output=%t.probe.proftext %S/Inputs/cs-sample-preinline-probe.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0 +RUN: llvm-profdata merge --sample --text -o %t.probe.proftext %S/Inputs/cs-sample-preinline-probe.proftext --convert-sample-profile-layout nest RUN: FileCheck %s < %t.probe.proftext --match-full-lines --strict-whitespace -check-prefix=PROBE -RUN: llvm-profdata merge --sample --extbinary -output=%t.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=0 -RUN: llvm-profdata merge --sample --text -output=%t2.proftext %t.profbin +RUN: llvm-profdata merge --sample --extbinary -o %t.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest +RUN: llvm-profdata merge --sample --text -o %t2.proftext %t.profbin RUN: FileCheck %s < %t2.proftext --match-full-lines --strict-whitespace -RUN: llvm-profdata show --sample -show-sec-info-only %t.profbin | FileCheck %s -check-prefix=PREINLINE -RUN: llvm-profdata merge --sample --text -output=%t3.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=1 +RUN: llvm-profdata show --sample --show-sec-info-only %t.profbin | FileCheck %s -check-prefix=PREINLINE +RUN: llvm-profdata merge --sample --text -o %t3.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest --generate-merged-base-profiles RUN: FileCheck %s < %t3.proftext --match-full-lines --strict-whitespace -check-prefix=RECOUNT -RUN: llvm-profdata merge --sample --extbinary -output=%t2.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout=nest -generate-merged-base-profiles=1 -RUN: llvm-profdata show -sample -detailed-summary %S/Inputs/cs-sample-preinline.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show -sample -detailed-summary %t2.profbin | FileCheck %s -check-prefix=SUMMARY-NEST -RUN: llvm-profdata show -sample -detailed-summary %t3.proftext | FileCheck %s -check-prefix=SUMMARY-NEST +RUN: llvm-profdata merge --sample --extbinary -o %t2.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest --generate-merged-base-profiles +RUN: llvm-profdata show --sample --detailed-summary %S/Inputs/cs-sample-preinline.proftext | FileCheck %s -check-prefix=SUMMARY +RUN: llvm-profdata show --sample --detailed-summary %t2.profbin | FileCheck %s -check-prefix=SUMMARY-NEST +RUN: llvm-profdata show --sample --detailed-summary %t3.proftext | FileCheck %s -check-prefix=SUMMARY-NEST ; CHECK:main:1968621:12 diff --git a/llvm/test/tools/llvm-profdata/cs-sample-profile.test b/llvm/test/tools/llvm-profdata/cs-sample-profile.test index ce69a1ffd61a6..9d90807664492 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-profile.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-profile.test @@ -1,6 +1,6 @@ -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample.proftext +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext RUN: diff -b %t.proftext %S/Inputs/cs-sample.proftext RUN: llvm-profdata merge --sample --extbinary %p/Inputs/cs-sample.proftext -o %t.prof && llvm-profdata merge --sample --text %t.prof -o %t1.proftext RUN: diff -b %t1.proftext %S/Inputs/cs-sample.proftext -RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s +RUN: llvm-profdata show --sample --show-sec-info-only %t.prof | FileCheck %s CHECK: FunctionMetadata {{.*}} Flags: {attr} diff --git a/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test b/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test index a25c89d96d7f8..0b8cc30b4b809 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test @@ -1,11 +1,11 @@ -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample.proftext +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext RUN: diff -b %t.proftext %S/Inputs/cs-sample.proftext -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -profile-summary-cold-count=500 +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --profile-summary-cold-count 500 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-MERGE -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -sample-trim-cold-context -profile-summary-cold-count=500 +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --sample-trim-cold-context --profile-summary-cold-count 500 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-END -RUN: llvm-profdata merge --sample --text -output=%t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -sample-trim-cold-context -profile-summary-cutoff-cold=990000 +RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --sample-trim-cold-context --profile-summary-cutoff-cold 990000 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-END CHECK-TRIM: [main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]:1467299:11 diff --git a/llvm/test/tools/llvm-profdata/csprof-dump.test b/llvm/test/tools/llvm-profdata/csprof-dump.test index a03b9d8a003e1..ae3154102b255 100644 --- a/llvm/test/tools/llvm-profdata/csprof-dump.test +++ b/llvm/test/tools/llvm-profdata/csprof-dump.test @@ -1,8 +1,8 @@ Basic test for option -showcs: RUN: llvm-profdata show %p/Inputs/cs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY RUN: llvm-profdata show %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show -showcs %p/Inputs/cs.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show -showcs %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY +RUN: llvm-profdata show --showcs %p/Inputs/cs.proftext | FileCheck %s -check-prefix=SUMMARY +RUN: llvm-profdata show --showcs %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY ZEROSUMMARY: Instrumentation level: IR ZEROSUMMARY: Total functions: 0 ZEROSUMMARY: Maximum function count: 0 @@ -15,17 +15,17 @@ SUMMARY: Maximum internal block count: 62 Basic tests for context sensitive profile dump functions: RUN: llvm-profdata merge -o %t-combined.profdata %p/Inputs/cs.proftext %p/Inputs/noncs.proftext -RUN: llvm-profdata show --all-functions -counts -showcs %p/Inputs/cs.proftext > %t-text.csdump -RUN: llvm-profdata show --all-functions -counts -showcs %t-combined.profdata > %t-index.csdump +RUN: llvm-profdata show --all-functions --counts --showcs %p/Inputs/cs.proftext > %t-text.csdump +RUN: llvm-profdata show --all-functions --counts --showcs %t-combined.profdata > %t-index.csdump RUN: diff %t-text.csdump %t-index.csdump -RUN: llvm-profdata show --all-functions -counts %p/Inputs/noncs.proftext > %t-text.noncsdump -RUN: llvm-profdata show --all-functions -counts %t-combined.profdata > %t-index.noncsdump +RUN: llvm-profdata show --all-functions --counts %p/Inputs/noncs.proftext > %t-text.noncsdump +RUN: llvm-profdata show --all-functions --counts %t-combined.profdata > %t-index.noncsdump RUN: diff %t-text.noncsdump %t-index.noncsdump Roundtrip test: RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/CSIR_profile.proftext -RUN: llvm-profdata merge -text -o %t.0.proftext %t.0.profdata +RUN: llvm-profdata merge --text -o %t.0.proftext %t.0.profdata RUN: diff -b %t.0.proftext %S/Inputs/CSIR_profile.proftext diff --git a/llvm/test/tools/llvm-profdata/cutoff.test b/llvm/test/tools/llvm-profdata/cutoff.test index 9d59ede4e8428..57114115aee46 100644 --- a/llvm/test/tools/llvm-profdata/cutoff.test +++ b/llvm/test/tools/llvm-profdata/cutoff.test @@ -1,11 +1,11 @@ Basic tests for cutoff options in show command. -RUN: llvm-profdata show -value-cutoff=1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1,CHECK -RUN: llvm-profdata show -value-cutoff=1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000,CHECK -RUN: llvm-profdata show -all-functions -value-cutoff=1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1FUNC,CUTOFF1,CHECK -RUN: llvm-profdata show -all-functions -value-cutoff=1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000FUNC,CUTOFF1000,CHECK -RUN: llvm-profdata show -value-cutoff=1 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1,CUTOFF1,CHECK -RUN: llvm-profdata show -value-cutoff=1000 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1000,CUTOFF1000,CHECK +RUN: llvm-profdata show --value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1,CHECK +RUN: llvm-profdata show --value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000,CHECK +RUN: llvm-profdata show --all-functions --value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1FUNC,CUTOFF1,CHECK +RUN: llvm-profdata show --all-functions --value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000FUNC,CUTOFF1000,CHECK +RUN: llvm-profdata show --value-cutoff 1 --list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1,CUTOFF1,CHECK +RUN: llvm-profdata show --value-cutoff 1000 --list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1000,CUTOFF1000,CHECK CUTOFF1FUNC-NOT: bar CUTOFF1FUNC: Functions shown: 2 CUTOFF1000FUNC-NOT: bar diff --git a/llvm/test/tools/llvm-profdata/forward-compatible.test b/llvm/test/tools/llvm-profdata/forward-compatible.test index 51a7336bb4056..a5b0883617e59 100644 --- a/llvm/test/tools/llvm-profdata/forward-compatible.test +++ b/llvm/test/tools/llvm-profdata/forward-compatible.test @@ -1,8 +1,8 @@ REQUIRES: zlib -RUN: llvm-profdata show -sample %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -RUN: llvm-profdata show -sample %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -RUN: llvm-profdata show -sample -show-sec-info-only %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -check-prefix=HDR -RUN: llvm-profdata show -sample -show-sec-info-only %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -check-prefix=HDR-COMPRESS +RUN: llvm-profdata show --sample %S/Inputs/unknown.section.extbin.profdata | FileCheck %s +RUN: llvm-profdata show --sample %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s +RUN: llvm-profdata show --sample --show-sec-info-only %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -check-prefix=HDR +RUN: llvm-profdata show --sample --show-sec-info-only %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -check-prefix=HDR-COMPRESS # The input unknown.section.extbin.profdata contains an unknown section type # which uses an enum value which won't be used in the near future. Check diff --git a/llvm/test/tools/llvm-profdata/general.proftext b/llvm/test/tools/llvm-profdata/general.proftext index 89762f2540f6a..72ba3c49ddf67 100644 --- a/llvm/test/tools/llvm-profdata/general.proftext +++ b/llvm/test/tools/llvm-profdata/general.proftext @@ -1,6 +1,6 @@ -# RUN: llvm-profdata merge -sparse=true %s -o %t.profdata +# RUN: llvm-profdata merge --sparse %s -o %t.profdata -# RUN: llvm-profdata merge -sparse=false %s -o %t.profdata.dense +# RUN: llvm-profdata merge %s -o %t.profdata.dense # RUN: llvm-profdata show %t.profdata --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY function_count_only @@ -79,10 +79,10 @@ hex_hash # DETAILED-SUMMARY: 6 blocks (60.00%) with count >= 72057594037927936 account for 99.99% of the total counts. # DETAILED-SUMMARY: 6 blocks (60.00%) with count >= 72057594037927936 account for 99.999% of the total counts. -# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-2 +# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs 600000 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-2 # DETAILED-SUMMARY-2: 2 blocks (28.57%) with count >= 1152921504606846976 account for 60% of the total counts. # -# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs=600000,900000,999999 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-3 +# RUN: llvm-profdata show --detailed-summary --detailed-summary-cutoffs 600000,900000,999999 %t.profdata | FileCheck %s -check-prefix=DETAILED-SUMMARY-3 # DETAILED-SUMMARY-3: 2 blocks (28.57%) with count >= 1152921504606846976 account for 60% of the total counts. # DETAILED-SUMMARY-3: 4 blocks (57.14%) with count >= 288230376151711744 account for 90% of the total counts. # DETAILED-SUMMARY-3: 6 blocks (85.71%) with count >= 72057594037927936 account for 99.9999% of the total counts. diff --git a/llvm/test/tools/llvm-profdata/hash-mismatch.proftext b/llvm/test/tools/llvm-profdata/hash-mismatch.proftext index 24908e288d6b4..15abd7f7760f1 100644 --- a/llvm/test/tools/llvm-profdata/hash-mismatch.proftext +++ b/llvm/test/tools/llvm-profdata/hash-mismatch.proftext @@ -2,7 +2,7 @@ # sure we keep both. # RUN: llvm-profdata merge %s -o %t 2>&1 -# RUN: llvm-profdata show %t -all-functions -counts > %t.out +# RUN: llvm-profdata show %t --all-functions --counts > %t.out # The function ordering is non-deterministic, so we need to do our # checks in multiple runs. diff --git a/llvm/test/tools/llvm-profdata/help.test b/llvm/test/tools/llvm-profdata/help.test index b1b1c6da8dd72..b1b3673591e45 100644 --- a/llvm/test/tools/llvm-profdata/help.test +++ b/llvm/test/tools/llvm-profdata/help.test @@ -5,18 +5,18 @@ # TOP: OVERVIEW: LLVM profile data # TOP: USAGE: llvm-profdata [subcommand] [options] # TOP: SUBCOMMANDS: -# TOP: merge - Takes several profiles and merge them together. -# TOP: show - Takes a profile data file and displays the profiles. +# TOP-DAG: merge - Takes several profiles and merge them together. +# TOP-DAG: show - Takes a profile data file and displays the profiles. # MERGE: OVERVIEW: LLVM profile data # MERGE: Takes several profiles and merge them together. # MERGE: OPTIONS: -# MERGE: -instr -# MERGE: -output -# MERGE: -sample +# MERGE-DAG: --instr +# MERGE-DAG: --output +# MERGE-DAG: --sample # SHOW: OVERVIEW: LLVM profile data # SHOW: Takes a profile data file and displays the profiles. # SHOW: OPTIONS: -# SHOW: -output -# SHOW: -show-format +# SHOW-DAG: --output +# SHOW-DAG: --show-format diff --git a/llvm/test/tools/llvm-profdata/input-dir.test b/llvm/test/tools/llvm-profdata/input-dir.test index 93918c1c8892d..f90eebf120231 100644 --- a/llvm/test/tools/llvm-profdata/input-dir.test +++ b/llvm/test/tools/llvm-profdata/input-dir.test @@ -12,8 +12,8 @@ RUN: echo ' ' > %t.dir2/bar RUN: echo ' ' > %t.dir2/foo RUN: echo ' ' > %t.dir2/subdir/baz -RUN: llvm-profdata merge -f %t.input -dump-input-file-list -o /dev/null | FileCheck %s -RUN: llvm-profdata merge -weighted-input=2,%t.dir2 -dump-input-file-list -o /dev/null %t.dir1 | FileCheck %s +RUN: llvm-profdata merge -f %t.input --dump-input-file-list -o /dev/null | FileCheck %s +RUN: llvm-profdata merge --weighted-input 2,%t.dir2 --dump-input-file-list -o /dev/null %t.dir1 | FileCheck %s CHECK-DAG: 1,{{.*}}.dir1{{[/\\]}}bar CHECK-DAG: 1,{{.*}}.dir1{{[/\\]}}foo diff --git a/llvm/test/tools/llvm-profdata/input-filenames.test b/llvm/test/tools/llvm-profdata/input-filenames.test index 4f29e7bea9b8f..048f940bd97f2 100644 --- a/llvm/test/tools/llvm-profdata/input-filenames.test +++ b/llvm/test/tools/llvm-profdata/input-filenames.test @@ -10,8 +10,8 @@ RUN: echo ' ' > %t.foo RUN: echo ' ' > %t.bar RUN: echo ' ' > %t.baz -RUN: llvm-profdata merge -f %t.input -dump-input-file-list -o /dev/null %t.foo | FileCheck %s -RUN: llvm-profdata merge -input-files %t.input -dump-input-file-list -o /dev/null %t.foo | FileCheck %s +RUN: llvm-profdata merge -f %t.input --dump-input-file-list -o /dev/null %t.foo | FileCheck %s +RUN: llvm-profdata merge --input-files %t.input --dump-input-file-list -o /dev/null %t.foo | FileCheck %s CHECK: 1,{{.*}}.foo CHECK-NEXT: 1,{{.*}}.bar diff --git a/llvm/test/tools/llvm-profdata/input-wildcard.test b/llvm/test/tools/llvm-profdata/input-wildcard.test index f2c46c962a817..115aa209012d2 100644 --- a/llvm/test/tools/llvm-profdata/input-wildcard.test +++ b/llvm/test/tools/llvm-profdata/input-wildcard.test @@ -8,7 +8,7 @@ RUN: echo '# empty profile 1' > %t.prof1.proftxt RUN: echo '# empty profile 2' >> %t.prof2.proftxt # Prevent LIT itself from globbing by quoting the wildcard argument. -RUN: llvm-profdata merge "%t.*.proftxt" -dump-input-file-list -o /dev/null | FileCheck %s +RUN: llvm-profdata merge "%t.*.proftxt" --dump-input-file-list -o /dev/null | FileCheck %s # Verify that llvm-profdata expanded the wildcard argument. CHECK: 1,{{.*}}.prof1.proftxt diff --git a/llvm/test/tools/llvm-profdata/instr-remap.test b/llvm/test/tools/llvm-profdata/instr-remap.test index 27fddf6095812..82189b110dba4 100644 --- a/llvm/test/tools/llvm-profdata/instr-remap.test +++ b/llvm/test/tools/llvm-profdata/instr-remap.test @@ -1,2 +1,2 @@ -; RUN: llvm-profdata merge -text %S/Inputs/instr-remap.proftext -r %S/Inputs/instr-remap.remap -o %t.output +; RUN: llvm-profdata merge --text %S/Inputs/instr-remap.proftext -r %S/Inputs/instr-remap.remap -o %t.output ; RUN: diff -b %S/Inputs/instr-remap.expected %t.output diff --git a/llvm/test/tools/llvm-profdata/invalid-profdata.test b/llvm/test/tools/llvm-profdata/invalid-profdata.test index efa16392e42e7..29006248272b7 100644 --- a/llvm/test/tools/llvm-profdata/invalid-profdata.test +++ b/llvm/test/tools/llvm-profdata/invalid-profdata.test @@ -20,7 +20,7 @@ RUN: echo "f2:0" >> %t.input RUN: echo "1" >> %t.input RUN: echo ":10" >> %t.input -RUN: not llvm-profdata merge %t.input -text -output=/dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN +RUN: not llvm-profdata merge %t.input --text -o /dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN BROKEN: warning: {{.*}}invalid-profdata.test.tmp.input: malformed instrumentation profile data BROKEN-NEXT: error: no profile can be merged @@ -46,6 +46,6 @@ RUN: echo "f2:0" >> %t.input RUN: echo "1" >> %t.input RUN: echo "** External Symbol **:10" >> %t.input -# RUN: llvm-profdata merge %t.input -text -output=%t.out && cat %t.out | FileCheck %s +# RUN: llvm-profdata merge %t.input --text -o %t.out && cat %t.out | FileCheck %s CHECK: ** External Symbol **:10 diff --git a/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test b/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test index 157c13b926a7e..bd7159f0bea18 100644 --- a/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test +++ b/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test @@ -80,13 +80,13 @@ RUN: printf '\3\0foo\0\0\0' >> %t-good.profraw RUN: not llvm-profdata merge %t-bad.profraw %t-good.profraw -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ANY ANY: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -// -failure-mode=all only fails if there is a warning for every input file. -RUN: not llvm-profdata merge %t-bad.profraw -failure-mode=all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-ERR +// --failure-mode all only fails if there is a warning for every input file. +RUN: not llvm-profdata merge %t-bad.profraw --failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-ERR ALL-ERR: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -RUN: llvm-profdata merge %t-bad.profraw %t-good.profraw -failure-mode=all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-WARN +RUN: llvm-profdata merge %t-bad.profraw %t-good.profraw --failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-WARN ALL-WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -// -failure-mode=warn does not fail at all. It only prints warnings. -RUN: llvm-profdata merge %t-bad.profraw -failure-mode=warn -o %t.profdata 2>&1 | FileCheck %s --check-prefix=WARN +// --failure-mode warn does not fail at all. It only prints warnings. +RUN: llvm-profdata merge %t-bad.profraw --failure-mode warn -o %t.profdata 2>&1 | FileCheck %s --check-prefix=WARN WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 diff --git a/llvm/test/tools/llvm-profdata/mcdc-bitmap.test b/llvm/test/tools/llvm-profdata/mcdc-bitmap.test index a7b1b5df8c306..9df65002df52d 100644 --- a/llvm/test/tools/llvm-profdata/mcdc-bitmap.test +++ b/llvm/test/tools/llvm-profdata/mcdc-bitmap.test @@ -3,10 +3,10 @@ # Merge as profdata. RUN: split-file %s %t RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.profdata -RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC +RUN: llvm-profdata show %t.profdata --text --all-functions | FileCheck %s --check-prefix=MCDC # Merge as proftext. RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.proftext -RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC +RUN: llvm-profdata show %t.proftext --text --all-functions | FileCheck %s --check-prefix=MCDC MCDC: # Num Bitmap Bytes: MCDC-NEXT: $1 @@ -20,10 +20,10 @@ MCDC-NEXT: 0x0 # Merge as profdata. RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.profdata -RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC2 +RUN: llvm-profdata show %t.profdata --text --all-functions | FileCheck %s --check-prefix=MCDC2 # Merge as proftext. RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.proftext -RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC2 +RUN: llvm-profdata show %t.proftext --text --all-functions | FileCheck %s --check-prefix=MCDC2 MCDC2: # Num Bitmap Bytes: MCDC2-NEXT: $8 diff --git a/llvm/test/tools/llvm-profdata/memop-size-prof.proftext b/llvm/test/tools/llvm-profdata/memop-size-prof.proftext index 79dc0f8a16324..fa8eb623bb337 100644 --- a/llvm/test/tools/llvm-profdata/memop-size-prof.proftext +++ b/llvm/test/tools/llvm-profdata/memop-size-prof.proftext @@ -1,9 +1,9 @@ -# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %s | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM -# RUN: llvm-profdata show -memop-sizes -ic-targets -counts -text -function=foo %s | FileCheck %s --check-prefixes=TEXT,MEMOP_TEXT,ICALL_TEXT +# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %s | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata show --memop-sizes --ic-targets --counts --text --function foo %s | FileCheck %s --check-prefixes=TEXT,MEMOP_TEXT,ICALL_TEXT # RUN: llvm-profdata merge -o %t.profdata %s -# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %t.profdata | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM -# RUN: llvm-profdata merge -o %t.proftext -text %s -# RUN: llvm-profdata show -memop-sizes -ic-targets -function=foo %t.proftext| FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %t.profdata | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata merge -o %t.proftext --text %s +# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %t.proftext| FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM # IR level Instrumentation Flag :ir diff --git a/llvm/test/tools/llvm-profdata/memprof-merge-versions.test b/llvm/test/tools/llvm-profdata/memprof-merge-versions.test index 0a65872016259..91db00b44cb9b 100644 --- a/llvm/test/tools/llvm-profdata/memprof-merge-versions.test +++ b/llvm/test/tools/llvm-profdata/memprof-merge-versions.test @@ -7,16 +7,16 @@ RUN: echo "1" >> %t.proftext RUN: echo "1" >> %t.proftext To update the inputs used below run Inputs/update_memprof_inputs.sh /path/to/updated/clang -RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=2 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v2 +RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version 2 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v2 RUN: llvm-profdata show %t.prof.v2 | FileCheck %s -RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=2 --memprof-full-schema --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v2 +RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version 2 --memprof-full-schema --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v2 RUN: llvm-profdata show %t.prof.v2 | FileCheck %s -RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version=3 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v3 +RUN: llvm-profdata merge %t.proftext %p/Inputs/basic.memprofraw --memprof-version 3 --profiled-binary %p/Inputs/basic.memprofexe -o %t.prof.v3 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 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. diff --git a/llvm/test/tools/llvm-profdata/memprof-yaml.test b/llvm/test/tools/llvm-profdata/memprof-yaml.test index 69b3131a87f3d..3b24a5c5402c0 100644 --- a/llvm/test/tools/llvm-profdata/memprof-yaml.test +++ b/llvm/test/tools/llvm-profdata/memprof-yaml.test @@ -3,35 +3,35 @@ ; Verify that the YAML output is identical to the YAML input. ; memprof-in.yaml has both heap profile records and data access profiles. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof-in.yaml -o %t/memprof-out.indexed +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof-in.yaml -o %t/memprof-out.indexed ; RUN: llvm-profdata show --memory %t/memprof-out.indexed > %t/memprof-out.yaml ; RUN: diff -b %t/memprof-in.yaml %t/memprof-out.yaml ; Merge text profile as v3 binary profile. Test that the merged v3 profile ; are identical to memprof-in-v3.yaml, and doesn't have callee guids or dap. -; RUN: llvm-profdata merge --memprof-version=3 %t/memprof-in.yaml -o %t/memprof-out-v3.indexed +; RUN: llvm-profdata merge --memprof-version 3 %t/memprof-in.yaml -o %t/memprof-out-v3.indexed ; RUN: llvm-profdata show --memory %t/memprof-out-v3.indexed > %t/memprof-out-v3.yaml ; RUN: diff -b %t/memprof-out-v3.yaml %t/memprof-in-v3.yaml ; Make sure we can ingest a YAML profile containing AllocSites only. ; That is, CallSites are missing. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof-in-alloc-sites-only.yaml -o %t/memprof-out-alloc-sites-only.indexed +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof-in-alloc-sites-only.yaml -o %t/memprof-out-alloc-sites-only.indexed ; RUN: llvm-profdata show --memory %t/memprof-out-alloc-sites-only.indexed > %t/memprof-out-alloc-sites-only.yaml ; RUN: diff -b %t/memprof-out-alloc-sites-only.yaml %t/memprof-in-alloc-sites-only.yaml ; Make sure we can ingest a YAML profile containing CallSites only. ; That is, AllocSites are missing. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof-in-call-sites-only.yaml -o %t/memprof-out-call-sites-only.indexed +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof-in-call-sites-only.yaml -o %t/memprof-out-call-sites-only.indexed ; RUN: llvm-profdata show --memory %t/memprof-out-call-sites-only.indexed > %t/memprof-out-call-sites-only.yaml ; RUN: diff -b %t/memprof-out-call-sites-only.yaml %t/memprof-in-call-sites-only.yaml ; memprof-in-no-dap.yaml has empty data access profiles. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof-in-no-dap.yaml -o %t/memprof-out.indexed +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof-in-no-dap.yaml -o %t/memprof-out.indexed ; RUN: llvm-profdata show --memory %t/memprof-out.indexed > %t/memprof-out-no-dap.yaml ; RUN: diff -b %t/memprof-in-no-dap.yaml %t/memprof-out-no-dap.yaml ; memprof-in-no-heap.yaml has empty heap access profiles. -; RUN: llvm-profdata merge --memprof-version=4 %t/memprof-in-no-heap.yaml -o %t/memprof-out-no-heap.indexed +; RUN: llvm-profdata merge --memprof-version 4 %t/memprof-in-no-heap.yaml -o %t/memprof-out-no-heap.indexed ; RUN: llvm-profdata show --memory %t/memprof-out-no-heap.indexed > %t/memprof-out-no-heap.yaml ; RUN: diff -b %t/memprof-in-no-heap.yaml %t/memprof-out-no-heap.yaml diff --git a/llvm/test/tools/llvm-profdata/merge-filter.test b/llvm/test/tools/llvm-profdata/merge-filter.test index 5c47c6a75a7c4..fecd127d73f9d 100644 --- a/llvm/test/tools/llvm-profdata/merge-filter.test +++ b/llvm/test/tools/llvm-profdata/merge-filter.test @@ -1,28 +1,28 @@ Test llvm-profdata merge with function filters. -RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function="_Z3.*" | FileCheck %s --check-prefix=CHECK-FILTER1 -RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --no-function="main" | FileCheck %s --check-prefix=CHECK-FILTER1 +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function "_Z3.*" | FileCheck %s --check-prefix=CHECK-FILTER1 +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --no-function "main" | FileCheck %s --check-prefix=CHECK-FILTER1 CHECK-FILTER1: _Z3bari:20301:1437 CHECK-NEXT: 1: 1437 CHECK-NEXT: _Z3fooi:7711:610 CHECK-NEXT: 1: 610 CHECK-NOT: main -RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function="_Z3.*" --no-function="fooi$" | FileCheck %s --check-prefix=CHECK-FILTER2 +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function "_Z3.*" --no-function "fooi$" | FileCheck %s --check-prefix=CHECK-FILTER2 CHECK-FILTER2: _Z3bari:20301:1437 CHECK-NEXT: 1: 1437 CHECK-NOT: main CHECK-NOT: _Z3fooi -RUN: llvm-profdata merge --sample --extbinary --use-md5 -output=%t.0.profdata %p/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample %t.0.profdata --text --function="_Z3fooi" | FileCheck %s --check-prefix=CHECK-FILTER-MD5 +RUN: llvm-profdata merge --sample --extbinary --use-md5 -o %t.0.profdata %p/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample %t.0.profdata --text --function "_Z3fooi" | FileCheck %s --check-prefix=CHECK-FILTER-MD5 CHECK-FILTER-MD5: 1228452328526475178:7711:610 CHECK-NEXT: 1: 610 CHECK-NOT: 15822663052811949562 CHECK-NOT: 3727899762981752933 -RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function="foo" | FileCheck %s --check-prefix=CHECK-FILTER3 -RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --no-function="main" | FileCheck %s --check-prefix=CHECK-FILTER3 +RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function "foo" | FileCheck %s --check-prefix=CHECK-FILTER3 +RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --no-function "main" | FileCheck %s --check-prefix=CHECK-FILTER3 CHECK-FILTER3: foo CHECK-NEXT: # Func Hash: CHECK-NEXT: 10 @@ -41,7 +41,7 @@ CHECK-NEXT: # Counter Values: CHECK-NEXT: 500500 CHECK-NEXT: 180100 -RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function="foo" --no-function="^foo$" | FileCheck %s --check-prefix=CHECK-FILTER4 +RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function "foo" --no-function "^foo$" | FileCheck %s --check-prefix=CHECK-FILTER4 CHECK-FILTER4: foo2 CHECK-NEXT: # Func Hash: CHECK-NEXT: 10 @@ -51,7 +51,7 @@ CHECK-NEXT: # Counter Values: CHECK-NEXT: 500500 CHECK-NEXT: 180100 -RUN: llvm-profdata merge --sample %p/Inputs/cs-sample.proftext --text --function="main.*@.*_Z5funcBi" | FileCheck %s --check-prefix=CHECK-FILTER5 +RUN: llvm-profdata merge --sample %p/Inputs/cs-sample.proftext --text --function "main.*@.*_Z5funcBi" | FileCheck %s --check-prefix=CHECK-FILTER5 CHECK-FILTER5: [main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20 CHECK-NEXT: 0: 15 CHECK-NEXT: 1: 15 diff --git a/llvm/test/tools/llvm-profdata/merge-incompatible.test b/llvm/test/tools/llvm-profdata/merge-incompatible.test index fca72a452069e..fab3b198c1b15 100644 --- a/llvm/test/tools/llvm-profdata/merge-incompatible.test +++ b/llvm/test/tools/llvm-profdata/merge-incompatible.test @@ -4,5 +4,5 @@ CHECK: ir-basic.proftext: Merge IR generated profile with Clang generated profil // We get a slightly different error message when using multiple threads because // we do not know which files have incompatible kinds. -RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext --num-threads=2 -o /dev/null 2>&1 | FileCheck %s --check-prefix=THREADS +RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext --num-threads 2 -o /dev/null 2>&1 | FileCheck %s --check-prefix=THREADS THREADS: unsupported instrumentation profile format version diff --git a/llvm/test/tools/llvm-profdata/merge-probe-profile.test b/llvm/test/tools/llvm-profdata/merge-probe-profile.test index d05c950728747..a64750429452a 100644 --- a/llvm/test/tools/llvm-profdata/merge-probe-profile.test +++ b/llvm/test/tools/llvm-profdata/merge-probe-profile.test @@ -23,5 +23,5 @@ MERGE2: 5: 14 _Z3foov:10 _Z3barv:4 MERGE2: 6: 12 _Z3barv:8 _Z3foov:4 MERGE2: !CFGChecksum: 563022570642068 -RUN: llvm-profdata show --sample -show-sec-info-only %t | FileCheck %s +RUN: llvm-profdata show --sample --show-sec-info-only %t | FileCheck %s CHECK: FunctionMetadata {{.*}} Flags: {probe} \ No newline at end of file diff --git a/llvm/test/tools/llvm-profdata/merge-traces.proftext b/llvm/test/tools/llvm-profdata/merge-traces.proftext index 3512f33cd06a9..fcb6034130af8 100644 --- a/llvm/test/tools/llvm-profdata/merge-traces.proftext +++ b/llvm/test/tools/llvm-profdata/merge-traces.proftext @@ -1,23 +1,23 @@ -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s --text | FileCheck %s --check-prefixes=CHECK,SEEN1,SAMPLE1 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s --text | FileCheck %s --check-prefixes=CHECK,SEEN1,SAMPLE1 # Merge %s twice so it has two traces -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN2,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s -o %t-2.profdata +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN2,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s -o %t-2.profdata -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %t-2.profdata %s --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %t-2.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %t-2.profdata %s --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %t-2.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN3,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %t-2.profdata %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %t-2.profdata %t-2.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %t-2.profdata %s %s --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %t-2.profdata %t-2.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE2 # Test that we can increase the reservoir size, even if inputs are sampled -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s %s %s -o %t-4.profdata -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=4 %t-4.profdata %t-4.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN8,SAMPLE4 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s %s %s -o %t-4.profdata +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 4 %t-4.profdata %t-4.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN8,SAMPLE4 # Test that decreasing the reservoir size truncates traces -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=1 %t-4.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE1 +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 1 %t-4.profdata --text | FileCheck %s --check-prefixes=CHECK,SEEN4,SAMPLE1 # CHECK: :temporal_prof_traces # CHECK: # Num Temporal Profile Traces: diff --git a/llvm/test/tools/llvm-profdata/merge_empty_profile.test b/llvm/test/tools/llvm-profdata/merge_empty_profile.test index 013a4dcda6554..3cc6c725c2cdf 100644 --- a/llvm/test/tools/llvm-profdata/merge_empty_profile.test +++ b/llvm/test/tools/llvm-profdata/merge_empty_profile.test @@ -1,15 +1,15 @@ # Tests for merge of empty profile files. RUN: touch %t_empty.proftext -RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext | FileCheck %s -check-prefix=CLANG_PROF_TEXT -RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext --num-threads=2 | FileCheck %s -check-prefix=CLANG_PROF_TEXT +RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext | FileCheck %s -check-prefix=CLANG_PROF_TEXT +RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=CLANG_PROF_TEXT CLANG_PROF_TEXT: main CLANG_PROF_TEXT: 0 CLANG_PROF_TEXT: 1 CLANG_PROF_TEXT: 1 -RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext | FileCheck %s -check-prefix=IR_PROF_TEXT -RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext --num-threads=2 | FileCheck %s -check-prefix=IR_PROF_TEXT +RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext | FileCheck %s -check-prefix=IR_PROF_TEXT +RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=IR_PROF_TEXT IR_PROF_TEXT: :ir IR_PROF_TEXT: main IR_PROF_TEXT: 0 diff --git a/llvm/test/tools/llvm-profdata/multiple-inputs.test b/llvm/test/tools/llvm-profdata/multiple-inputs.test index 3a3caeac0c2e3..522d8876ac7ff 100644 --- a/llvm/test/tools/llvm-profdata/multiple-inputs.test +++ b/llvm/test/tools/llvm-profdata/multiple-inputs.test @@ -1,9 +1,9 @@ Some very basic tests for the multiple input cases. RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-2.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3 RUN: llvm-profdata merge %p/Inputs/foo3-2.proftext %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3 FOO3: foo: FOO3: Counters: 3 FOO3: Function count: 8 @@ -13,7 +13,7 @@ FOO3: Maximum function count: 8 FOO3: Maximum internal block count: 7 RUN: llvm-profdata merge %p/Inputs/empty.proftext %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3EMPTY FOO3EMPTY: foo: FOO3EMPTY: Counters: 3 FOO3EMPTY: Function count: 1 @@ -23,8 +23,8 @@ FOO3EMPTY: Maximum function count: 1 FOO3EMPTY: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3bar3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-1 -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-2 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-1 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-2 FOO3FOO3BAR3-1: foo: FOO3FOO3BAR3-1: Counters: 3 FOO3FOO3BAR3-1: Function count: 3 @@ -38,8 +38,8 @@ FOO3FOO3BAR3: Maximum function count: 7 FOO3FOO3BAR3: Maximum internal block count: 13 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/bar3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-1 -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-2 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-1 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-2 DISJOINT-1: foo: DISJOINT-1: Counters: 3 DISJOINT-1: Function count: 1 @@ -55,11 +55,11 @@ DISJOINT: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: -num-threads 2 -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO4 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: -j 3 -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO4 FOO4: foo: FOO4: Counters: 3 FOO4: Function count: 4 @@ -71,19 +71,19 @@ FOO4: Maximum internal block count: 12 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 2 -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 3 -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 1 -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 FOO5: foo: FOO5: Counters: 3 FOO5: Function count: 5 diff --git a/llvm/test/tools/llvm-profdata/overflow-instr.test b/llvm/test/tools/llvm-profdata/overflow-instr.test index 5541a67dc5f3e..c4980b758b104 100644 --- a/llvm/test/tools/llvm-profdata/overflow-instr.test +++ b/llvm/test/tools/llvm-profdata/overflow-instr.test @@ -1,15 +1,15 @@ Tests for overflow when merging instrumented profiles. 1- Merge profile having maximum counts with itself and verify overflow detected and saturation occurred -RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW +RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW +RUN: llvm-profdata show --instr --all-functions --counts %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW MERGE_OVERFLOW: {{.*}}.proftext: overflow: counter overflow SHOW_OVERFLOW: Function count: 18446744073709551613 SHOW_OVERFLOW-NEXT: Block counts: [18446744073709551613, 18446744073709551613] 2- Merge profile having maximum counts by itself and verify no overflow -RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW +RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW MERGE_NO_OVERFLOW-NOT: {{.*}}.proftext: overflow: counter overflow SHOW_NO_OVERFLOW: Function count: 18446744073709551613 SHOW_NO_OVERFLOW-NEXT: Block counts: [9223372036854775808, 18446744073709551613] diff --git a/llvm/test/tools/llvm-profdata/overflow-sample.test b/llvm/test/tools/llvm-profdata/overflow-sample.test index 83adf6d63b549..5d1877972f0cd 100644 --- a/llvm/test/tools/llvm-profdata/overflow-sample.test +++ b/llvm/test/tools/llvm-profdata/overflow-sample.test @@ -1,8 +1,8 @@ Tests for overflow when merging sampled profiles. 1- Merge profile having maximum counts with itself and verify overflow detected -RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW +RUN: llvm-profdata merge --sample %p/Inputs/overflow-sample.proftext %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW +RUN: llvm-profdata show --sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW MERGE_OVERFLOW: {{.*}}: main: Counter overflow SHOW_OVERFLOW-DAG: Function: main: 2000, 0, 2 sampled lines SHOW_OVERFLOW-DAG: Samples collected in the function's body { @@ -22,8 +22,8 @@ SHOW_OVERFLOW-DAG: } SHOW_OVERFLOW-DAG: No inlined callsites in this function 2- Merge profile having maximum counts by itself and verify no overflow -RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW -RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW +RUN: llvm-profdata merge --sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW +RUN: llvm-profdata show --sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW MERGE_NO_OVERFLOW-NOT: {{.*}}: main: Counter overflow SHOW_NO_OVERFLOW-DAG: Function: main: 1000, 0, 2 sampled lines SHOW_NO_OVERFLOW-DAG: Samples collected in the function's body { diff --git a/llvm/test/tools/llvm-profdata/overlap.test b/llvm/test/tools/llvm-profdata/overlap.test index 6470e3f19712b..dd59b63e52a3e 100644 --- a/llvm/test/tools/llvm-profdata/overlap.test +++ b/llvm/test/tools/llvm-profdata/overlap.test @@ -1,6 +1,6 @@ RUN: llvm-profdata overlap %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s -check-prefix=OVERLAP -RUN: llvm-profdata overlap -function=main %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP -RUN: llvm-profdata overlap -value-cutoff=15000 %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP +RUN: llvm-profdata overlap --function main %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP +RUN: llvm-profdata overlap --value-cutoff 15000 %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP RUN: llvm-profdata merge %p/Inputs/overlap_1.proftext -o %t_1.profdata RUN: llvm-profdata merge %p/Inputs/overlap_2.proftext -o %t_2.profdata RUN: llvm-profdata overlap %t_1.profdata %t_2.profdata | FileCheck %s -check-prefix=OVERLAP diff --git a/llvm/test/tools/llvm-profdata/overlap_cs.test b/llvm/test/tools/llvm-profdata/overlap_cs.test index ba15418f87da8..289d2b69850e1 100644 --- a/llvm/test/tools/llvm-profdata/overlap_cs.test +++ b/llvm/test/tools/llvm-profdata/overlap_cs.test @@ -1,7 +1,7 @@ -RUN: llvm-profdata overlap -cs %p/Inputs/overlap_1_cs.proftext %p/Inputs/overlap_2_cs.proftext | FileCheck %s -check-prefix=OVERLAP +RUN: llvm-profdata overlap --cs %p/Inputs/overlap_1_cs.proftext %p/Inputs/overlap_2_cs.proftext | FileCheck %s -check-prefix=OVERLAP RUN: llvm-profdata merge %p/Inputs/overlap_1_cs.proftext -o %t_1_cs.profdata RUN: llvm-profdata merge %p/Inputs/overlap_2_cs.proftext -o %t_2_cs.profdata -RUN: llvm-profdata overlap -cs %t_1_cs.profdata %t_2_cs.profdata | FileCheck %s -check-prefix=OVERLAP +RUN: llvm-profdata overlap --cs %t_1_cs.profdata %t_2_cs.profdata | FileCheck %s -check-prefix=OVERLAP OVERLAP: Profile overlap information for base_profile: {{.*}} and test_profile: OVERLAP: Program level: OVERLAP: # of functions overlap: 1 diff --git a/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test b/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test index 8383bcc1a2fbe..d6dac11a15f10 100644 --- a/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test +++ b/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test @@ -1,15 +1,15 @@ REQUIRES: zlib -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -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 -compress-all-sections -prof-sym-list=%S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --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 --compress-all-sections --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list.expected %t.4.output ;; Generate two SampleFDO binary profiles and merge them. ;; Tests that the vtable counters in the merged profile are the aggregated ;; result from both sources. -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof -prof-sym-list=%S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output -; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output +; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list-ext.expected %t.4.output diff --git a/llvm/test/tools/llvm-profdata/profile-symbol-list.test b/llvm/test/tools/llvm-profdata/profile-symbol-list.test index 6845531066c76..a51a653860c0c 100644 --- a/llvm/test/tools/llvm-profdata/profile-symbol-list.test +++ b/llvm/test/tools/llvm-profdata/profile-symbol-list.test @@ -1,18 +1,18 @@ -; RUN: llvm-profdata merge -sample -extbinary -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 -prof-sym-list=%S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output -; RUN: llvm-profdata merge -sample -extbinary %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge --sample --extbinary --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 --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output +; RUN: llvm-profdata merge --sample --extbinary %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list.expected %t.4.output -; RUN: llvm-profdata merge -sample -extbinary --drop-profile-symbol-list %t.1.output %t.2.output -o %t.5.output -; RUN: llvm-profdata show -sample -show-sec-info-only %t.5.output | FileCheck %s -check-prefix=NOSYMLIST +; RUN: llvm-profdata merge --sample --extbinary --drop-profile-symbol-list %t.1.output %t.2.output -o %t.5.output +; RUN: llvm-profdata show --sample --show-sec-info-only %t.5.output | FileCheck %s -check-prefix=NOSYMLIST ; NOSYMLIST: ProfileSymbolListSection {{.*}} Size: 0 ;; Generate two SampleFDO binary profiles and merge them. ;; Tests that the vtable counters in the merged profile are the aggregated ;; result from both sources. -; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output -; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof -prof-sym-list=%S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output -; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output +; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output +; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list-ext.expected %t.4.output diff --git a/llvm/test/tools/llvm-profdata/pseudo_count.test b/llvm/test/tools/llvm-profdata/pseudo_count.test index 7915866d3270f..61f85bb9dd67f 100644 --- a/llvm/test/tools/llvm-profdata/pseudo_count.test +++ b/llvm/test/tools/llvm-profdata/pseudo_count.test @@ -1,17 +1,17 @@ Tests for merging instrumented profiles with pseudo counts. -RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-warm.proftext -o %t1.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t1.out | FileCheck %s --check-prefix=MERGE_WARM -RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-warm.proftext %p/Inputs/pseudo-count-warm.proftext -o %t2.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t2.out | FileCheck %s --check-prefix=MERGE_WARM -RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext -o %t3.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t3.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-hot.proftext -o %t4.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t4.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-warm.proftext -o %t5.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show -instr -all-functions -counts %t5.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-warm.proftext -o %t6.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING -RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-hot.proftext -o %t7.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING +RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-warm.proftext -o %t1.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t1.out | FileCheck %s --check-prefix=MERGE_WARM +RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-warm.proftext %p/Inputs/pseudo-count-warm.proftext -o %t2.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t2.out | FileCheck %s --check-prefix=MERGE_WARM +RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext -o %t3.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t3.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-hot.proftext -o %t4.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t4.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-warm.proftext -o %t5.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show --instr --all-functions --counts %t5.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-warm.proftext -o %t6.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING +RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-hot.proftext -o %t7.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING MERGE_OVERFLOW-NOT: {{.*}}.proftext: overflow: counter overflow MERGE_WARM: Counters: 3 diff --git a/llvm/test/tools/llvm-profdata/raw-32-bits-be.test b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test index 6b3dc96b36270..218e17a7ba0a6 100644 --- a/llvm/test/tools/llvm-profdata/raw-32-bits-be.test +++ b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test @@ -45,8 +45,8 @@ RUN: printf '\0\0\0\0\0\0\0\101' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s -RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s +RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-32-bits-le.test b/llvm/test/tools/llvm-profdata/raw-32-bits-le.test index 95625565f5c0c..0bbd13ce763a7 100644 --- a/llvm/test/tools/llvm-profdata/raw-32-bits-le.test +++ b/llvm/test/tools/llvm-profdata/raw-32-bits-le.test @@ -44,8 +44,8 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s -RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s +RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-64-bits-be.test b/llvm/test/tools/llvm-profdata/raw-64-bits-be.test index 5316ef5a3e559..c10a65e657779 100644 --- a/llvm/test/tools/llvm-profdata/raw-64-bits-be.test +++ b/llvm/test/tools/llvm-profdata/raw-64-bits-be.test @@ -44,8 +44,8 @@ RUN: printf '\0\0\0\0\0\0\0\101' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s -RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s +RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-64-bits-le.test b/llvm/test/tools/llvm-profdata/raw-64-bits-le.test index 58f4da8cf0386..4f55d82a6c53f 100644 --- a/llvm/test/tools/llvm-profdata/raw-64-bits-le.test +++ b/llvm/test/tools/llvm-profdata/raw-64-bits-le.test @@ -44,8 +44,8 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s -RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s +RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-two-profiles.test b/llvm/test/tools/llvm-profdata/raw-two-profiles.test index 47cc6fa4fd7fe..7706664713d94 100644 --- a/llvm/test/tools/llvm-profdata/raw-two-profiles.test +++ b/llvm/test/tools/llvm-profdata/raw-two-profiles.test @@ -61,7 +61,7 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\3\0bar\0\0\0' >> %t-bar.profraw RUN: cat %t-foo.profraw %t-bar.profraw > %t-pad.profraw -RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t-pad.profraw --all-functions --counts | FileCheck %s CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/read-traces.proftext b/llvm/test/tools/llvm-profdata/read-traces.proftext index 5e822a9ea53ec..79e961cf03ce1 100644 --- a/llvm/test/tools/llvm-profdata/read-traces.proftext +++ b/llvm/test/tools/llvm-profdata/read-traces.proftext @@ -1,9 +1,9 @@ -# RUN: llvm-profdata merge -text %s -o %t.1.proftext -# RUN: llvm-profdata merge -binary %t.1.proftext -o %t.2.profdata -# RUN: llvm-profdata merge -text %t.2.profdata -o %t.3.proftext +# RUN: llvm-profdata merge --text %s -o %t.1.proftext +# RUN: llvm-profdata merge --binary %t.1.proftext -o %t.2.profdata +# RUN: llvm-profdata merge --text %t.2.profdata -o %t.3.proftext # RUN: diff %t.1.proftext %t.3.proftext -# RUN: llvm-profdata merge -text %s | FileCheck %s +# RUN: llvm-profdata merge --text %s | FileCheck %s # CHECK: :temporal_prof_traces # CHECK: # Num Temporal Profile Traces: diff --git a/llvm/test/tools/llvm-profdata/roundtrip-compress.test b/llvm/test/tools/llvm-profdata/roundtrip-compress.test index cf0c344e7874b..56bafe752a610 100644 --- a/llvm/test/tools/llvm-profdata/roundtrip-compress.test +++ b/llvm/test/tools/llvm-profdata/roundtrip-compress.test @@ -1,10 +1,10 @@ REQUIRES: zlib # Round trip from text --> compressed extbinary --> text -RUN: llvm-profdata merge --sample --extbinary -compress-all-sections -output=%t.1.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --text -output=%t.1.proftext %t.1.profdata +RUN: llvm-profdata merge --sample --extbinary --compress-all-sections -o %t.1.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --text -o %t.1.proftext %t.1.profdata RUN: diff -b %t.1.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> binary --> compressed extbinary --> text -RUN: llvm-profdata merge --sample --binary -output=%t.2.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --extbinary -compress-all-sections -output=%t.3.profdata %t.2.profdata -RUN: llvm-profdata merge --sample --text -output=%t.2.proftext %t.3.profdata +RUN: llvm-profdata merge --sample --binary -o %t.2.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --extbinary --compress-all-sections -o %t.3.profdata %t.2.profdata +RUN: llvm-profdata merge --sample --text -o %t.2.proftext %t.3.profdata RUN: diff -b %t.2.proftext %S/Inputs/sample-profile.proftext diff --git a/llvm/test/tools/llvm-profdata/roundtrip.test b/llvm/test/tools/llvm-profdata/roundtrip.test index eb55534763877..2351a0deff0db 100644 --- a/llvm/test/tools/llvm-profdata/roundtrip.test +++ b/llvm/test/tools/llvm-profdata/roundtrip.test @@ -1,24 +1,24 @@ RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/IR_profile.proftext -RUN: llvm-profdata show -o %t.0.proftext -all-functions -text %t.0.profdata +RUN: llvm-profdata show -o %t.0.proftext --all-functions --text %t.0.profdata RUN: diff -b %t.0.proftext %S/Inputs/IR_profile.proftext RUN: llvm-profdata merge -o %t.1.profdata %t.0.proftext -RUN: llvm-profdata show -o %t.1.proftext -all-functions -text %t.1.profdata +RUN: llvm-profdata show -o %t.1.proftext --all-functions --text %t.1.profdata RUN: diff -b %t.1.proftext %S/Inputs/IR_profile.proftext -RUN: llvm-profdata merge --sample --binary -output=%t.2.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --text -output=%t.2.proftext %t.2.profdata +RUN: llvm-profdata merge --sample --binary -o %t.2.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --text -o %t.2.proftext %t.2.profdata RUN: diff -b %t.2.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> extbinary --> text -RUN: llvm-profdata merge --sample --extbinary -output=%t.3.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --text -output=%t.3.proftext %t.3.profdata +RUN: llvm-profdata merge --sample --extbinary -o %t.3.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --text -o %t.3.proftext %t.3.profdata RUN: diff -b %t.3.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> binary --> extbinary --> text -RUN: llvm-profdata merge --sample --binary -output=%t.4.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --extbinary -output=%t.5.profdata %t.4.profdata -RUN: llvm-profdata merge --sample --text -output=%t.4.proftext %t.5.profdata +RUN: llvm-profdata merge --sample --binary -o %t.4.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --extbinary -o %t.5.profdata %t.4.profdata +RUN: llvm-profdata merge --sample --text -o %t.4.proftext %t.5.profdata RUN: diff -b %t.4.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> extbinary --> text. # The vtable profile is supported by ext-binary profile but not raw binary profile format, # so we don't use raw binary profile format in this roundtrip. -RUN: llvm-profdata merge --sample --extbinary -extbinary-write-vtable-type-prof --output=%t.5.profdata %S/Inputs/sample-profile-ext.proftext -RUN: llvm-profdata merge --sample --text --output=%t.5.proftext %t.5.profdata +RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof -o %t.5.profdata %S/Inputs/sample-profile-ext.proftext +RUN: llvm-profdata merge --sample --text -o %t.5.proftext %t.5.profdata RUN: diff -b %t.5.proftext %S/Inputs/sample-profile-ext.proftext diff --git a/llvm/test/tools/llvm-profdata/same-filename.test b/llvm/test/tools/llvm-profdata/same-filename.test index 1bb437b844ec6..d2d95761e260f 100644 --- a/llvm/test/tools/llvm-profdata/same-filename.test +++ b/llvm/test/tools/llvm-profdata/same-filename.test @@ -2,13 +2,13 @@ Test the input file names overlap with the output file names. This is OK for merging instrument profiles. RUN: cp %S/Inputs/same-name-1.proftext %t.0.proftext -RUN: llvm-profdata merge -o %t.0.profdata -text %t.0.proftext %t.0.proftext -RUN: llvm-profdata show -counts -all-functions %t.0.profdata -o %t_show_0 -RUN: llvm-profdata show -counts -all-functions %S/Inputs/same-name-2.proftext -o %t_show_1 +RUN: llvm-profdata merge -o %t.0.profdata --text %t.0.proftext %t.0.proftext +RUN: llvm-profdata show --counts --all-functions %t.0.profdata -o %t_show_0 +RUN: llvm-profdata show --counts --all-functions %S/Inputs/same-name-2.proftext -o %t_show_1 RUN: diff %t_show_0 %t_show_1 RUN: llvm-profdata merge -o %t.1.profdata %S/Inputs/same-name-1.proftext RUN: llvm-profdata merge -o %t.1.profdata %t.1.profdata %t.1.profdata -RUN: llvm-profdata show -counts -all-functions %t.1.profdata -o %t_show_2 +RUN: llvm-profdata show --counts --all-functions %t.1.profdata -o %t_show_2 RUN: diff %t_show_2 %t_show_1 We report error for the show command. @@ -17,11 +17,11 @@ CHECK: llvm-profdata{{.*}} show: Input file name cannot be the same as the outpu This is OK for merging sample fdo profiles. RUN: cp %S/Inputs/same-name-3.proftext %t.3.proftext -RUN: llvm-profdata merge --sample -o %t.3.profdata -text %t.3.proftext %t.3.proftext -RUN: llvm-profdata show --sample -counts -all-functions %t.3.profdata -o %t_show_3 -RUN: llvm-profdata show --sample -counts -all-functions %S/Inputs/same-name-4.proftext -o %t_show_4 +RUN: llvm-profdata merge --sample -o %t.3.profdata --text %t.3.proftext %t.3.proftext +RUN: llvm-profdata show --sample --counts --all-functions %t.3.profdata -o %t_show_3 +RUN: llvm-profdata show --sample --counts --all-functions %S/Inputs/same-name-4.proftext -o %t_show_4 RUN: diff %t_show_3 %t_show_4 RUN: llvm-profdata merge --sample -o %t.5.profdata %S/Inputs/same-name-3.proftext RUN: llvm-profdata merge --sample -o %t.5.profdata %t.5.profdata %t.5.profdata -RUN: llvm-profdata show --sample -counts -all-functions %t.5.profdata -o %t_show_6 +RUN: llvm-profdata show --sample --counts --all-functions %t.5.profdata -o %t_show_6 RUN: diff %t_show_6 %t_show_4 diff --git a/llvm/test/tools/llvm-profdata/sample-flatten-profile.test b/llvm/test/tools/llvm-profdata/sample-flatten-profile.test index f99021bc6b723..d55e3c47c99c3 100644 --- a/llvm/test/tools/llvm-profdata/sample-flatten-profile.test +++ b/llvm/test/tools/llvm-profdata/sample-flatten-profile.test @@ -1,8 +1,8 @@ -; RUN: llvm-profdata merge --sample --convert-sample-profile-layout=flat --text %S/Inputs/sample-flatten-profile.proftext -o - | FileCheck %s --match-full-lines --strict-whitespace -; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/sample-flatten-profile.proftext -o %t2 && llvm-profdata merge --sample --convert-sample-profile-layout=flat --text %t2 -o - | FileCheck %s --match-full-lines --strict-whitespace +; RUN: llvm-profdata merge --sample --convert-sample-profile-layout flat --text %S/Inputs/sample-flatten-profile.proftext -o - | FileCheck %s --match-full-lines --strict-whitespace +; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/sample-flatten-profile.proftext -o %t2 && llvm-profdata merge --sample --convert-sample-profile-layout flat --text %t2 -o - | FileCheck %s --match-full-lines --strict-whitespace -; RUN: llvm-profdata merge --sample --convert-sample-profile-layout=flat --text %S/Inputs/sample-flatten-profile-cs.proftext -o - | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CHECK-CS -; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/sample-flatten-profile-cs.proftext -o %t2 && llvm-profdata merge --sample --convert-sample-profile-layout=flat --text %t2 -o - | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CHECK-CS +; RUN: llvm-profdata merge --sample --convert-sample-profile-layout flat --text %S/Inputs/sample-flatten-profile-cs.proftext -o - | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CHECK-CS +; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/sample-flatten-profile-cs.proftext -o %t2 && llvm-profdata merge --sample --convert-sample-profile-layout flat --text %t2 -o - | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CHECK-CS ; CHECK:baz:169:10 ; CHECK-NEXT: 1: 10 diff --git a/llvm/test/tools/llvm-profdata/sample-fs.test b/llvm/test/tools/llvm-profdata/sample-fs.test index d3d038b17ab70..2146556b81568 100644 --- a/llvm/test/tools/llvm-profdata/sample-fs.test +++ b/llvm/test/tools/llvm-profdata/sample-fs.test @@ -1,8 +1,8 @@ Basic tests for sample profiles using fs discriminators. 1- Show command and keep all the discrimiantor bits -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs | FileCheck %s --check-prefix=SHOW1 -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=PassLast | FileCheck %s --check-prefix=SHOW1 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs | FileCheck %s --check-prefix=SHOW1 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass PassLast | FileCheck %s --check-prefix=SHOW1 SHOW1: Function: main: 6436, 0, 6 sampled lines SHOW1: Samples collected in the function's body { SHOW1: 4: 534 @@ -14,7 +14,7 @@ SHOW1: 5.738209025: 2150 SHOW1: } 2- Show command and keep only the base discriminator bits -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base | FileCheck %s --check-prefix=SHOW2 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base | FileCheck %s --check-prefix=SHOW2 SHOW2: Function: main: 6436, 0, 4 sampled lines SHOW2: Samples collected in the function's body { SHOW2: 4: 534 @@ -24,7 +24,7 @@ SHOW2: 5.1: 3225 SHOW2: } 3- Show command and keep only the base discriminator bits and first pass of FS discriminator -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 | FileCheck %s --check-prefix=SHOW3 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 | FileCheck %s --check-prefix=SHOW3 Function: main: 6436, 0, 6 sampled lines SHOW3: Samples collected in the function's body { SHOW3: 4: 534 @@ -36,23 +36,23 @@ SHOW3: 5.11521: 2150 SHOW3: } 4- Merge command and keep all the discrimiantor bits -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=PassLast --binary -o - | llvm-profdata show --sample - -o %t1-binary_1 -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2 -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -o %t1-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass PassLast --binary -o - | llvm-profdata show --sample - -o %t1-binary_1 +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs -o %t1-text RUN: diff %t1-binary_1 %t1-text RUN: diff %t1-binary_2 %t1-text 2- Merge command and keep only the base discriminator bits -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base --binary -o - | llvm-profdata show --sample - -o %t2-binary -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Base -o %t2-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base --binary -o - | llvm-profdata show --sample - -o %t2-binary +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base -o %t2-text RUN: diff %t2-binary %t2-text 3- Merge command and keep only the base discriminator bits and first pass of FS discriminator -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 --binary -o - | llvm-profdata show --sample - -o %t3-binary -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 -o %t3-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 --binary -o - | llvm-profdata show --sample - -o %t3-binary +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 -o %t3-text RUN: diff %t3-binary %t3-text 4- ProfileIsFS is set properly in extbinary format from the internal option -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --extbinary -o %t_extbin.afdo +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --extbinary -o %t_extbin.afdo RUN: llvm-profdata show --sample --show-sec-info-only %t_extbin.afdo | FileCheck %s --check-prefix=ISFSSET ISFSSET: Flags: {fs-discriminator} diff --git a/llvm/test/tools/llvm-profdata/sample-hot-func-list.test b/llvm/test/tools/llvm-profdata/sample-hot-func-list.test index 91a8d817d55f6..402923fce07b2 100644 --- a/llvm/test/tools/llvm-profdata/sample-hot-func-list.test +++ b/llvm/test/tools/llvm-profdata/sample-hot-func-list.test @@ -21,7 +21,7 @@ ; CS-NEXT: 500853 (25.44%) 74946 20 main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi -; RUN: llvm-profdata show --sample --topn=2 %S/Inputs/sample-hot-func-list.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=TOPN +; RUN: llvm-profdata show --sample --topn 2 %S/Inputs/sample-hot-func-list.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=TOPN ; TOPN:8 out of 10 functions with profile (80.00%) are considered hot functions (max sample >= 470). ; TOPN-NEXT:355251 out of 356026 profile counts (99.78%) are from hot functions. @@ -29,7 +29,7 @@ ; TOPN-NEXT: 184019 (51.69%) 2300 534 main ; TOPN-NEXT: 97401 (27.36%) 10640 3035 Func3 -; RUN: llvm-profdata show --sample --topn=1 %S/Inputs/cs-sample.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CS-TOPN +; RUN: llvm-profdata show --sample --topn 1 %S/Inputs/cs-sample.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CS-TOPN ; CS-TOPN:2 out of 8 functions with profile (25.00%) are considered hot functions (max sample >= 23324). ; CS-TOPN-NEXT:1968152 out of 1968919 profile counts (99.96%) are from hot functions. diff --git a/llvm/test/tools/llvm-profdata/sample-overlap.test b/llvm/test/tools/llvm-profdata/sample-overlap.test index 859b705e5f3bd..36123f7fac3b2 100644 --- a/llvm/test/tools/llvm-profdata/sample-overlap.test +++ b/llvm/test/tools/llvm-profdata/sample-overlap.test @@ -40,7 +40,7 @@ ; OVERLAP1: hot blocks unique in base profile: 0 ; OVERLAP1: hot blocks unique in test profile: 0 -; RUN: llvm-profdata overlap --sample --similarity-cutoff=800000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-2.proftext | FileCheck %s --check-prefix=OVERLAP2 --match-full-lines --strict-whitespace +; RUN: llvm-profdata overlap --sample --similarity-cutoff 800000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-2.proftext | FileCheck %s --check-prefix=OVERLAP2 --match-full-lines --strict-whitespace ; OVERLAP2:Program level: ; OVERLAP2: Whole program profile similarity: 63.720% ; OVERLAP2: Whole program sample overlap: 29.649% @@ -65,7 +65,7 @@ ; OVERLAP2:78.15% 26.29% 48.09% 9.98% 0.00% 0.00% 10896 1087 main ; OVERLAP2:10.31% 34.76% 75.55% 100.00% 0.00% 0.00% 1437 1437 _Z3bari -; RUN: llvm-profdata overlap --sample --value-cutoff=1000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-3.proftext | FileCheck %s --check-prefix=OVERLAP3 --match-full-lines --strict-whitespace +; RUN: llvm-profdata overlap --sample --value-cutoff 1000 %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-3.proftext | FileCheck %s --check-prefix=OVERLAP3 --match-full-lines --strict-whitespace ; OVERLAP3:Program level: ; OVERLAP3: Whole program profile similarity: 14.301% ; OVERLAP3: Whole program sample overlap: 6.040% @@ -90,7 +90,7 @@ ; OVERLAP3:10.31% 11.02% 99.29% 100.00% 0.00% 0.00% 1437 1437 _Z3bari ; OVERLAP3:0.00% 83.54% 0.00% 0.00% 0.00% 100.00% 0 10896 main2 -; RUN: llvm-profdata overlap --sample --function=main %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-4.proftext | FileCheck %s --check-prefix=OVERLAP4 --match-full-lines --strict-whitespace +; RUN: llvm-profdata overlap --sample --function main %S/Inputs/sample-overlap-0.proftext %S/Inputs/sample-overlap-4.proftext | FileCheck %s --check-prefix=OVERLAP4 --match-full-lines --strict-whitespace ; OVERLAP4:Program level: ; OVERLAP4: Whole program profile similarity: 17.302% ; OVERLAP4: Whole program sample overlap: 8.134% diff --git a/llvm/test/tools/llvm-profdata/sample-profile-basic.test b/llvm/test/tools/llvm-profdata/sample-profile-basic.test index 0b0d37aac36cf..bf501f42883f2 100644 --- a/llvm/test/tools/llvm-profdata/sample-profile-basic.test +++ b/llvm/test/tools/llvm-profdata/sample-profile-basic.test @@ -9,7 +9,7 @@ SHOW1-DAG: Function: _Z3bari: 20301, 1437, 1 sampled lines SHOW1-DAG: 1: 1437 2- Show only bar -RUN: llvm-profdata show --sample --function=_Z3bari %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW2 +RUN: llvm-profdata show --sample --function _Z3bari %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW2 SHOW2: Function: _Z3bari: 20301, 1437, 1 sampled lines SHOW2: 1: 1437 SHOW2-NOT: Function: main: 184019, 0, 7 sampled lines diff --git a/llvm/test/tools/llvm-profdata/sample-profile-json.test b/llvm/test/tools/llvm-profdata/sample-profile-json.test index 9e96693faace6..d114b6056ed6e 100644 --- a/llvm/test/tools/llvm-profdata/sample-profile-json.test +++ b/llvm/test/tools/llvm-profdata/sample-profile-json.test @@ -1,5 +1,5 @@ RUN: llvm-profdata show --sample --json %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=JSON -RUN: llvm-profdata show --sample --show-format=json %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=JSON +RUN: llvm-profdata show --sample --show-format json %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=JSON JSON: [ JSON-NEXT: { JSON-NEXT: "name": "main", diff --git a/llvm/test/tools/llvm-profdata/sample-remap.test b/llvm/test/tools/llvm-profdata/sample-remap.test index 8e69c45726635..a7098738695bd 100644 --- a/llvm/test/tools/llvm-profdata/sample-remap.test +++ b/llvm/test/tools/llvm-profdata/sample-remap.test @@ -1,2 +1,2 @@ -; RUN: llvm-profdata merge -sample -text %S/Inputs/sample-remap.proftext -r %S/Inputs/sample-remap.remap -o %t.output +; RUN: llvm-profdata merge --sample --text %S/Inputs/sample-remap.proftext -r %S/Inputs/sample-remap.remap -o %t.output ; RUN: diff -b %S/Inputs/sample-remap.expected %t.output diff --git a/llvm/test/tools/llvm-profdata/sample-split-layout.test b/llvm/test/tools/llvm-profdata/sample-split-layout.test index 51091e9f25c02..ea6193b840b3b 100644 --- a/llvm/test/tools/llvm-profdata/sample-split-layout.test +++ b/llvm/test/tools/llvm-profdata/sample-split-layout.test @@ -1,6 +1,5 @@ -RUN: llvm-profdata merge --sample --extbinary --split-layout %p/Inputs/sample-profile.proftext -o %t-output - -RUN: llvm-profdata merge --sample --text --split-layout %t-output | FileCheck %s +RUN: llvm-profdata merge --sample --extbinary --split-layout %p/Inputs/sample-profile.proftext -o %t-o +RUN: llvm-profdata merge --sample --text --split-layout %t-o | FileCheck %s CHECK: main:184019:0 CHECK-NEXT: 4: 534 CHECK-NEXT: 4.2: 534 diff --git a/llvm/test/tools/llvm-profdata/sample-summary.test b/llvm/test/tools/llvm-profdata/sample-summary.test index 310cc8bfb721c..9c1473b96b814 100644 --- a/llvm/test/tools/llvm-profdata/sample-summary.test +++ b/llvm/test/tools/llvm-profdata/sample-summary.test @@ -1,4 +1,4 @@ -; RUN: llvm-profdata show -sample -detailed-summary %S/Inputs/sample-profile.proftext | FileCheck %s +; RUN: llvm-profdata show --sample --detailed-summary %S/Inputs/sample-profile.proftext | FileCheck %s ; CHECK: Total functions: 3 ; CHECK-NEXT: Maximum function count: 1437 diff --git a/llvm/test/tools/llvm-profdata/show-order-error.proftext b/llvm/test/tools/llvm-profdata/show-order-error.proftext index 633f1a9949b6f..ff1d3f163d184 100644 --- a/llvm/test/tools/llvm-profdata/show-order-error.proftext +++ b/llvm/test/tools/llvm-profdata/show-order-error.proftext @@ -1,4 +1,4 @@ -# RUN: not llvm-profdata order %s --num-test-traces=10 2>&1 | FileCheck %s +# RUN: not llvm-profdata order %s --num-test-traces 10 2>&1 | FileCheck %s # CHECK: --num-test-traces must be smaller than the total number of traces diff --git a/llvm/test/tools/llvm-profdata/show-order.proftext b/llvm/test/tools/llvm-profdata/show-order.proftext index 28eb1b9b42af7..59750b2f42e8b 100644 --- a/llvm/test/tools/llvm-profdata/show-order.proftext +++ b/llvm/test/tools/llvm-profdata/show-order.proftext @@ -1,4 +1,4 @@ -# RUN: llvm-profdata order %s --num-test-traces=1 | FileCheck %s +# RUN: llvm-profdata order %s --num-test-traces 1 | FileCheck %s # CHECK: # Total area under the page fault curve: 4.000000e+00 diff --git a/llvm/test/tools/llvm-profdata/show-prof-info.test b/llvm/test/tools/llvm-profdata/show-prof-info.test index 2b38dee5d865e..13eaf7d26e423 100644 --- a/llvm/test/tools/llvm-profdata/show-prof-info.test +++ b/llvm/test/tools/llvm-profdata/show-prof-info.test @@ -1,7 +1,7 @@ REQUIRES: zlib -; 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: 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: llvm-profdata show --sample --show-sec-info-only %t.1.output >> %t.txt ; RUN: FileCheck %s --input-file=%t.txt ; CHECK: [[FILESIZE:.*]] ; To check llvm-profdata shows the correct flags for ProfileSummarySection. diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test index 4a394d7bce5c5..982887d213ea4 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test @@ -3,9 +3,9 @@ with flattening. Test bar.cc:bar's counters will be set to PseudoHot. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/flatten_sample.proftext \ +RUN: --supplement-instr-with-sample %p/Inputs/flatten_sample.proftext \ RUN: %p/Inputs/flatten_instr.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FLATTEN +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FLATTEN FLATTEN: foo: FLATTEN-NEXT: Hash: 0x0000000000000457 diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test index 2d500df28a92b..9bca631bb70f2 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test @@ -1,16 +1,16 @@ Some basic tests for supplementing instrumentation profile with sample profile for static funcs. -RUN: llvm-profdata merge -supplement-instr-with-sample=%p/Inputs/NoFUnique.afdotext -suppl-min-size-threshold=2 %p/Inputs/NoFUnique.proftext -o %t1 -RUN: llvm-profdata show -function=foo -counts %t1 | FileCheck %s +RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t1 +RUN: llvm-profdata show --function foo --counts %t1 | FileCheck %s -RUN: llvm-profdata merge -supplement-instr-with-sample=%p/Inputs/FUnique.afdotext -suppl-min-size-threshold=2 %p/Inputs/FUnique.proftext -o %t2 -RUN: llvm-profdata show -function=foo -counts %t2 | FileCheck %s +RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/FUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t2 +RUN: llvm-profdata show --function foo --counts %t2 | FileCheck %s -RUN: llvm-profdata merge -supplement-instr-with-sample=%p/Inputs/NoFUnique.afdotext -suppl-min-size-threshold=2 %p/Inputs/FUnique.proftext -o %t3 -RUN: llvm-profdata show -function=foo -counts %t3 | FileCheck %s +RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t3 +RUN: llvm-profdata show --function foo --counts %t3 | FileCheck %s -RUN: llvm-profdata merge -supplement-instr-with-sample=%p/Inputs/FUnique.afdotext -suppl-min-size-threshold=2 %p/Inputs/NoFUnique.proftext -o %t4 -RUN: llvm-profdata show -function=foo -counts %t4 | FileCheck %s +RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/FUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t4 +RUN: llvm-profdata show --function foo --counts %t4 | FileCheck %s CHECK: Counters: 3 CHECK-NEXT: Instrumentation level: diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test index c22646e45849e..291e0114a0eca 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test @@ -2,9 +2,9 @@ Some basic tests for supplementing instrumentation profile with sample profile. Test all of goo's counters will be set to PseudoHot. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \ -RUN: -suppl-min-size-threshold=0 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX1 +RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: --suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX1 MIX1: foo: MIX1-NEXT: Hash: 0x0000000000000007 @@ -22,10 +22,10 @@ MIX1-NEXT: Block counts: [3000, 1000, 2000, 500] Test when the zero counter ratio of foo is higher than zero-counter-threshold. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \ -RUN: -suppl-min-size-threshold=0 -zero-counter-threshold=0.5 \ -RUN: -instr-prof-cold-threshold=30 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX2 +RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: --suppl-min-size-threshold 0 --zero-counter-threshold 0.5 \ +RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX2 MIX2: foo: MIX2-NEXT: Hash: 0x0000000000000007 @@ -44,10 +44,10 @@ MIX2-NEXT: Block counts: [3000, 1000, 2000, 500] Test when the zero counter ratio of foo is lower than zero-counter-threshold. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \ -RUN: -suppl-min-size-threshold=0 -zero-counter-threshold=0.7 \ -RUN: -instr-prof-cold-threshold=30 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX3 +RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: --suppl-min-size-threshold 0 --zero-counter-threshold 0.7 \ +RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX3 MIX3: foo: MIX3-NEXT: Hash: 0x0000000000000007 @@ -66,10 +66,10 @@ MIX3-NEXT: Block counts: [3000, 1000, 2000, 500] Test foo's profile won't be adjusted because its size is smaller than suppl-min-size-threshold. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \ -RUN: -suppl-min-size-threshold=2 -zero-counter-threshold=0.7 \ -RUN: -instr-prof-cold-threshold=30 %p/Inputs/mix_instr_small.proftext -o %t -RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX4 +RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: --suppl-min-size-threshold 2 --zero-counter-threshold 0.7 \ +RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr_small.proftext -o %t +RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX4 MIX4: foo: MIX4-NEXT: Hash: 0x0000000000000007 @@ -87,9 +87,9 @@ MIX4-NEXT: Block counts: [0] Test profile summary won't be affected by pseudo counters. RUN: llvm-profdata merge \ -RUN: -supplement-instr-with-sample=%p/Inputs/mix_sample.proftext \ -RUN: -suppl-min-size-threshold=0 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t -detailed-summary | FileCheck %s --check-prefix=MIX5 +RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: --suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t --detailed-summary | FileCheck %s --check-prefix=MIX5 MIX5: Instrumentation level: IR MIX5-NEXT: Total functions: 2 diff --git a/llvm/test/tools/llvm-profdata/text-dump.test b/llvm/test/tools/llvm-profdata/text-dump.test index 22acb6e23039a..e11e05e356ce6 100644 --- a/llvm/test/tools/llvm-profdata/text-dump.test +++ b/llvm/test/tools/llvm-profdata/text-dump.test @@ -1,20 +1,20 @@ Basic tests for testing text dump functions. -RUN: llvm-profdata show --all-functions -counts --text %p/Inputs/basic.proftext > %t-basic.proftext1 +RUN: llvm-profdata show --all-functions --counts --text %p/Inputs/basic.proftext > %t-basic.proftext1 RUN: llvm-profdata merge -o %t-basic.proftext2 --text %p/Inputs/basic.proftext RUN: llvm-profdata merge --text %p/Inputs/basic.proftext | diff %t-basic.proftext2 - -RUN: llvm-profdata merge -binary -o %t-basic.profdata1 %t-basic.proftext1 +RUN: llvm-profdata merge --binary -o %t-basic.profdata1 %t-basic.proftext1 RUN: llvm-profdata merge -o %t-basic.profdata2 %t-basic.proftext2 -RUN: llvm-profdata show --all-functions -counts %t-basic.profdata1 > %t-basic.dump3 -RUN: llvm-profdata show --all-functions -counts %t-basic.profdata2 > %t-basic.dump4 +RUN: llvm-profdata show --all-functions --counts %t-basic.profdata1 > %t-basic.dump3 +RUN: llvm-profdata show --all-functions --counts %t-basic.profdata2 > %t-basic.dump4 -RUN: llvm-profdata merge -text -o %t-basic.proftext5 %t-basic.profdata1 -RUN: llvm-profdata merge -text -o %t-basic.proftext6 %t-basic.profdata2 +RUN: llvm-profdata merge --text -o %t-basic.proftext5 %t-basic.profdata1 +RUN: llvm-profdata merge --text -o %t-basic.proftext6 %t-basic.profdata2 RUN: diff %t-basic.dump3 %t-basic.dump4 RUN: diff %t-basic.proftext5 %t-basic.proftext6 -RUN: not llvm-profdata merge -gcc -o %t-basic-profdata3 %t-basic.proftext2 2>&1 | FileCheck %s --check-prefix=UNKNOWN +RUN: not llvm-profdata merge --gcc -o %t-basic-profdata3 %t-basic.proftext2 2>&1 | FileCheck %s --check-prefix=UNKNOWN UNKNOWN: unknown format is specified diff --git a/llvm/test/tools/llvm-profdata/text-format-errors.test b/llvm/test/tools/llvm-profdata/text-format-errors.test index 4a75edd70ff40..309d14ffb6be9 100644 --- a/llvm/test/tools/llvm-profdata/text-format-errors.test +++ b/llvm/test/tools/llvm-profdata/text-format-errors.test @@ -5,7 +5,7 @@ RUN: not llvm-profdata show %p/Inputs/invalid-count-later.proftext 2>&1 | FileCh INVALID-COUNT-LATER-SHOW: error: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE -RUN: not llvm-profdata merge -failure-mode=all %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE +RUN: not llvm-profdata merge --failure-mode all %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE INVALID-COUNT-LATER-MERGE: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data INVALID-COUNT-LATER-MERGE-NEXT: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data INVALID-COUNT-LATER-MERGE-NEXT: error: no profile can be merged diff --git a/llvm/test/tools/llvm-profdata/trace-limit.proftext b/llvm/test/tools/llvm-profdata/trace-limit.proftext index 6b4f974add169..3ab0f19d6c5d4 100644 --- a/llvm/test/tools/llvm-profdata/trace-limit.proftext +++ b/llvm/test/tools/llvm-profdata/trace-limit.proftext @@ -1,14 +1,14 @@ -# RUN: llvm-profdata merge --temporal-profile-max-trace-length=0 %s -o %t.profdata +# RUN: llvm-profdata merge --temporal-profile-max-trace-length 0 %s -o %t.profdata # RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --check-prefix=NONE -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 %s %s %s %s -o %t.profdata -# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size=2 --temporal-profile-max-trace-length=0 %t.profdata -o %t.profdata +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 %s %s %s %s -o %t.profdata +# RUN: llvm-profdata merge --temporal-profile-trace-reservoir-size 2 --temporal-profile-max-trace-length 0 %t.profdata -o %t.profdata # RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --check-prefix=NONE -# RUN: llvm-profdata merge --temporal-profile-max-trace-length=2 %s -o %t.profdata +# RUN: llvm-profdata merge --temporal-profile-max-trace-length 2 %s -o %t.profdata # RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --check-prefixes=CHECK,SOME -# RUN: llvm-profdata merge --temporal-profile-max-trace-length=1000 %s -o %t.profdata +# RUN: llvm-profdata merge --temporal-profile-max-trace-length 1000 %s -o %t.profdata # RUN: llvm-profdata show --temporal-profile-traces %t.profdata | FileCheck %s --check-prefixes=CHECK,ALL # NONE: Temporal Profile Traces (samples=0 seen=0): diff --git a/llvm/test/tools/llvm-profdata/value-prof.proftext b/llvm/test/tools/llvm-profdata/value-prof.proftext index ec09e40e496d7..a6bfff56c9e28 100644 --- a/llvm/test/tools/llvm-profdata/value-prof.proftext +++ b/llvm/test/tools/llvm-profdata/value-prof.proftext @@ -1,7 +1,7 @@ -# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefixes=ICTXT,ICSUM -# RUN: llvm-profdata show -ic-targets -counts -text -all-functions %s | FileCheck %s --check-prefix=ICTEXT +# RUN: llvm-profdata show --ic-targets --all-functions %s | FileCheck %s --check-prefixes=ICTXT,ICSUM +# RUN: llvm-profdata show --ic-targets --counts --text --all-functions %s | FileCheck %s --check-prefix=ICTEXT # RUN: llvm-profdata merge -o %t.profdata %s -# RUN: llvm-profdata show -ic-targets -all-functions %t.profdata | FileCheck %s --check-prefixes=IC,ICSUM +# RUN: llvm-profdata show --ic-targets --all-functions %t.profdata | FileCheck %s --check-prefixes=IC,ICSUM foo # Func Hash: diff --git a/llvm/test/tools/llvm-profdata/vtable-value-prof.test b/llvm/test/tools/llvm-profdata/vtable-value-prof.test index 5ed4a356e1041..185f630283a0a 100644 --- a/llvm/test/tools/llvm-profdata/vtable-value-prof.test +++ b/llvm/test/tools/llvm-profdata/vtable-value-prof.test @@ -4,15 +4,15 @@ RUN: llvm-profdata merge --keep-vtable-symbols %S/Inputs/vtable-value-prof.proftext -o %t/indexed.profdata ; Show indexed profiles -RUN: llvm-profdata show --function=main --ic-targets --show-vtables %t/indexed.profdata | FileCheck %s --check-prefix=INDEXED +RUN: llvm-profdata show --function main --ic-targets --show-vtables %t/indexed.profdata | FileCheck %s --check-prefix=INDEXED ; Show text profiles -RUN: llvm-profdata show --function=main --ic-targets --show-vtables --text %S/Inputs/vtable-value-prof.proftext | FileCheck %s --check-prefix=ICTEXT +RUN: llvm-profdata show --function main --ic-targets --show-vtables --text %S/Inputs/vtable-value-prof.proftext | FileCheck %s --check-prefix=ICTEXT ; Convert indexed profiles to its textual output and show it. RUN: llvm-profdata merge --keep-vtable-symbols --text -o %t/text-from-indexed.proftext %t/indexed.profdata -RUN: llvm-profdata show --function=main --ic-targets --show-vtables %t/text-from-indexed.proftext | FileCheck %s --check-prefix=INDEXED -RUN: llvm-profdata show --function=main --ic-targets --show-vtables --text %t/text-from-indexed.proftext | FileCheck %s --check-prefix=ICTEXT +RUN: llvm-profdata show --function main --ic-targets --show-vtables %t/text-from-indexed.proftext | FileCheck %s --check-prefix=INDEXED +RUN: llvm-profdata show --function main --ic-targets --show-vtables --text %t/text-from-indexed.proftext | FileCheck %s --check-prefix=ICTEXT INDEXED: Counters: INDEXED-NEXT: main: diff --git a/llvm/test/tools/llvm-profdata/weight-instr.test b/llvm/test/tools/llvm-profdata/weight-instr.test index 3f6979a071d29..c42ba179424b9 100644 --- a/llvm/test/tools/llvm-profdata/weight-instr.test +++ b/llvm/test/tools/llvm-profdata/weight-instr.test @@ -1,14 +1,14 @@ Tests for weighted merge of instrumented profiles. 1- Merge the foo and bar profiles with unity weight and verify the combined output -RUN: llvm-profdata merge -instr -weighted-input=1,%p/Inputs/weight-instr-bar.profdata -weighted-input=1,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t > %t.out1 +RUN: llvm-profdata merge --instr --weighted-input 1,%p/Inputs/weight-instr-bar.profdata --weighted-input 1,%p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show --instr --all-functions %t > %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-1 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-2 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-3 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-4 < %t.out1 -RUN: llvm-profdata merge -instr -weighted-input=1,%p/Inputs/weight-instr-bar.profdata %p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t > %t.out2 +RUN: llvm-profdata merge --instr --weighted-input 1,%p/Inputs/weight-instr-bar.profdata %p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show --instr --all-functions %t > %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-1 < %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-2 < %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-3 < %t.out2 @@ -36,8 +36,8 @@ RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-4 < %t.out2 1X_1X_WEIGHT-NEXT: Maximum internal block count: 267914296 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output -RUN: llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=5,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show -instr -all-functions %t > %t.out3 +RUN: llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 5,%p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show --instr --all-functions %t > %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-1 < %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-2 < %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-3 < %t.out3 @@ -65,17 +65,17 @@ RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-4 < %t.out3 3X_5X_WEIGHT-NEXT: Maximum internal block count: 1339571480 3- Bad merge: invalid weight -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=0,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=0.75,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=-5,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/weight-instr-bar.profdata -weighted-input=%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 0,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 0.75,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input -5,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input ,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input %p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT INVALID_WEIGHT: error: input weight must be a positive integer 4- Bad merge: input path does not exist -RUN: not llvm-profdata merge -instr -weighted-input=3,%p/Inputs/does-not-exist.profdata -weighted-input=2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT +RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/does-not-exist.profdata --weighted-input 2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.profdata: [[MSG]] 5- No inputs -RUN: not llvm-profdata merge -instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT -NO_INPUT: error: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help +RUN: not llvm-profdata merge --instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT +NO_INPUT: error: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge --help diff --git a/llvm/test/tools/llvm-profdata/weight-sample.test b/llvm/test/tools/llvm-profdata/weight-sample.test index 4c28a4a1ebf40..3f7f6b401ba21 100644 --- a/llvm/test/tools/llvm-profdata/weight-sample.test +++ b/llvm/test/tools/llvm-profdata/weight-sample.test @@ -1,8 +1,8 @@ Tests for weighted merge of sample profiles. 1- Merge the foo and bar profiles with unity weight and verify the combined output -RUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample-bar.proftext -weighted-input=1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT -RUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata merge --sample --text --weighted-input 1,%p/Inputs/weight-sample-bar.proftext --weighted-input 1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata merge --sample --text --weighted-input 1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT 1X_1X_WEIGHT-DAG: foo:1763288:35327 1X_1X_WEIGHT-DAG: 7: 35327 1X_1X_WEIGHT-DAG: 8: 35327 @@ -21,7 +21,7 @@ RUN: llvm-profdata merge -sample -text -weighted-input=1,%p/Inputs/weight-sample 1X_1X_WEIGHT-DAG: 25: 36666 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output -RUN: llvm-profdata merge -sample -text -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT +RUN: llvm-profdata merge --sample --text --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT 3X_5X_WEIGHT-DAG: foo:8816440:176635 3X_5X_WEIGHT-DAG: 7: 176635 3X_5X_WEIGHT-DAG: 8: 176635 @@ -40,17 +40,17 @@ RUN: llvm-profdata merge -sample -text -weighted-input=3,%p/Inputs/weight-sample 3X_5X_WEIGHT-DAG: 25: 109998 3- Bad merge: invalid weight -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=-5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/weight-sample-bar.proftext -weighted-input=%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input -5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input ,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input %p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT INVALID_WEIGHT: error: input weight must be a positive integer 4- Bad merge: input path does not exist -RUN: not llvm-profdata merge -sample -weighted-input=3,%p/Inputs/does-not-exist.proftext -weighted-input=2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT +RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/does-not-exist.proftext --weighted-input 2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: [[MSG]] 5- No inputs -RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT -NO_INPUT: {{.*}}: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help +RUN: not llvm-profdata merge --sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT +NO_INPUT: {{.*}}: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge --help diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test index dbef3aac66786..37ca02ad91717 100644 --- a/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test +++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable-pie.test @@ -3,7 +3,7 @@ RUN: --data-access-perftrace=%p/Inputs/pie-dap-perf.txt \ RUN: --binary=%p/Inputs/dap-pie.bin --format=text --pid=1725662 \ RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo -RUN: llvm-profdata show --sample --function=_Z9loop_funciii %t.afdo 2>&1 | FileCheck %s --dump-input=always +RUN: llvm-profdata show --sample --function _Z9loop_funciii %t.afdo 2>&1 | FileCheck %s --dump-input=always RUN: not llvm-profgen --perfscript=%p/Inputs/pie-lbr-perf.script \ RUN: --data-access-perftrace=%p/Inputs/pie-dap-perf.txt \ diff --git a/llvm/test/tools/llvm-profgen/afdo-with-vtable.test b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test index 799d59d56526e..f703fea2c8cd9 100644 --- a/llvm/test/tools/llvm-profgen/afdo-with-vtable.test +++ b/llvm/test/tools/llvm-profgen/afdo-with-vtable.test @@ -2,7 +2,7 @@ RUN: llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-p RUN: --binary=%p/Inputs/dap.bin --format=text --pid=3446532 \ RUN: -ignore-stack-samples -use-dwarf-correlation -o %t.afdo -RUN: llvm-profdata show --sample --function=_Z9loop_funciii %t.afdo 2>&1 | FileCheck %s +RUN: llvm-profdata show --sample --function _Z9loop_funciii %t.afdo 2>&1 | FileCheck %s RUN: not llvm-profgen --perfscript=%p/Inputs/lbr-perf-for-dap.script --data-access-perftrace=%p/Inputs/dap-perf-trace.txt \ RUN: --binary=%p/Inputs/dap.bin --format=text --pid=3446532 \ diff --git a/llvm/test/tools/llvm-profgen/cs-extbinary.test b/llvm/test/tools/llvm-profgen/cs-extbinary.test index 654b7d4cf2fa4..d5e2b6a9a98e3 100644 --- a/llvm/test/tools/llvm-profgen/cs-extbinary.test +++ b/llvm/test/tools/llvm-profgen/cs-extbinary.test @@ -1,14 +1,14 @@ ; test for dwarf-based cs profile ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/recursion-compression-noprobe.perfscript --binary=%S/Inputs/recursion-compression-noprobe.perfbin --output=%t1 --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0 -; RUN: llvm-profdata merge --sample --text --output=%t2 %t1 +; RUN: llvm-profdata merge --sample --text -o %t2 %t1 ; RUN: FileCheck %S/recursion-compression-noprobe.test --input-file %t2 -; RUN: llvm-profdata merge --sample --extbinary --output=%t3 %t2 && llvm-profdata merge --sample --text --output=%t4 %t3 +; RUN: llvm-profdata merge --sample --extbinary -o %t3 %t2 && llvm-profdata merge --sample --text -o %t4 %t3 ; RUN: diff -b %t2 %t4 ; test for probe-based cs profile ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t5 --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0 -; RUN: llvm-profdata merge --sample --text --output=%t6 %t5 +; RUN: llvm-profdata merge --sample --text -o %t6 %t5 ; RUN: FileCheck %S/recursion-compression-pseudoprobe.test --input-file %t6 -; RUN: llvm-profdata merge --sample --extbinary --output=%t7 %t6 && llvm-profdata merge --sample --text --output=%t8 %t7 +; RUN: llvm-profdata merge --sample --extbinary -o %t7 %t6 && llvm-profdata merge --sample --text -o %t8 %t7 ; RUN: diff -b %t6 %t8 diff --git a/llvm/test/tools/llvm-profgen/cs-preinline.test b/llvm/test/tools/llvm-profgen/cs-preinline.test index b48d63cf75b77..c6f6d1d3fedc2 100644 --- a/llvm/test/tools/llvm-profgen/cs-preinline.test +++ b/llvm/test/tools/llvm-profgen/cs-preinline.test @@ -21,15 +21,15 @@ ; Test preInlined flat is set for extbinary profiles with preinliner on. ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t2.prof -; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample --show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t5.prof --gen-cs-nested-profile=1 -; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample --show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; Test preInlined flat is set when converted from a text profile that has "ShouldInline" contexts. ; RUN: llvm-profdata merge --sample %t2 -o %t2.prof --extbinary -; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample --show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; RUN: llvm-profdata merge --sample %t5 -o %t5.prof --extbinary -; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample --show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; CHECK-DEFAULT: [main:1 @ foo]:309:0 diff --git a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test index 5f8d89f7ba8e7..a2805f98ab5f2 100644 --- a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test +++ b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test @@ -6,7 +6,7 @@ ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-STRIP-CTX ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --profile-summary-cold-count=0 --populate-profile-symbol-list=1 --csspgo-preinliner=0 --gen-cs-nested-profile=0 -; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST +; RUN: llvm-profdata show --show-prof-sym-list --sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST ; CHECK-SYM-LIST: Dump profile symbol list ; CHECK-SYM-LIST: bar diff --git a/llvm/test/tools/llvm-profgen/inline-noprobe2.test b/llvm/test/tools/llvm-profgen/inline-noprobe2.test index e19d991f0f1c4..ab696dd13162e 100644 --- a/llvm/test/tools/llvm-profgen/inline-noprobe2.test +++ b/llvm/test/tools/llvm-profgen/inline-noprobe2.test @@ -6,7 +6,7 @@ ; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t --populate-profile-symbol-list=1 -; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST +; RUN: llvm-profdata show --show-prof-sym-list --sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST ; CHECK-EXT-ADDR: 2 ; CHECK-EXT-ADDR-NEXT: 400870-400870:2 diff --git a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test index f4682787553d2..80ac402c1b20d 100644 --- a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test +++ b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test @@ -13,9 +13,9 @@ ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noinline-cs-noprobe.perfscript --binary=%S/Inputs/noinline-cs-noprobe.perfbin --output=%t1 --profile-summary-cold-count=0 ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/noinline-cs-noprobe.perfscript --binary=%S/Inputs/noinline-cs-noprobe.perfbin --output=%t2 --profile-summary-cold-count=0 -use-md5 -; RUN: llvm-profdata show --sample -show-sec-info-only %t2 | FileCheck %s --check-prefix=CHECK-MD5 -; RUN: llvm-profdata show --sample -detailed-summary --function=dummy %t1 > %t.summary -; RUN: llvm-profdata show --sample -detailed-summary --function=dummy %t2 > %t2.summary +; RUN: llvm-profdata show --sample --show-sec-info-only %t2 | FileCheck %s --check-prefix=CHECK-MD5 +; RUN: llvm-profdata show --sample --detailed-summary --function dummy %t1 > %t.summary +; RUN: llvm-profdata show --sample --detailed-summary --function dummy %t2 > %t2.summary ; RUN: diff -b %t.summary %t2.summary diff --git a/llvm/tools/llvm-profdata/Opts.td b/llvm/tools/llvm-profdata/Opts.td index 5244e9638ff16..e147b60a9b062 100644 --- a/llvm/tools/llvm-profdata/Opts.td +++ b/llvm/tools/llvm-profdata/Opts.td @@ -22,359 +22,346 @@ def Merge : SubCommand<"merge", "https://llvm.org/docs/CommandGuide/llvm-profdata.html" "#profdata-merge">; -def help : Flag<["-","--"], "help", [Show, Order, Overlap, Merge]>, - HelpText<"Display this help">; -def help_hidden : Flag<["--"], "help-hidden", [Show, Order, Overlap, Merge]>, - HelpText<"Display all help, including hidden options">; -def version : Flag<["--"], "version", [Show, Order, Overlap, Merge]>, - HelpText<"Display the version">; - -def output : JoinedOrSeparate<["-","--"], "output", +def help : Flag<["--"], "help">, HelpText<"Display this help">; +def version : Flag<["--"], "version">, HelpText<"Display the version">; + +def output : JoinedOrSeparate<["--"], "output", [Show, Order, Overlap, Merge]>, MetaVarName<"">, HelpText<"Output file">; def : JoinedOrSeparate<["-"], "o", [Show, Order, Overlap, Merge]>, Alias, HelpText<"Alias for --output">; -def instr : Flag<["-","--"], "instr", [Show, Overlap, Merge]>, +def instr : Flag<["--"], "instr", [Show, Overlap, Merge]>, HelpText<"Instrumentation profile (default)">; -def sample : Flag<["-","--"], "sample", [Show, Overlap, Merge]>, +def sample : Flag<["--"], "sample", [Show, Overlap, Merge]>, HelpText<"Sample profile">; -def memory : Flag<["-","--"], "memory", [Show]>, +def memory : Flag<["--"], "memory", [Show]>, HelpText<"MemProf memory access profile">; def max_debug_info_correlation_warnings - : JoinedOrSeparate<["-","--"], "max-debug-info-correlation-warnings", + : JoinedOrSeparate<["--"], "max-debug-info-correlation-warnings", [Show, Merge]>, HelpText<"Maximum number of warnings to emit when correlating profile " "from debug info (0 = no limit)">, MetaVarName<"">; def profiled_binary - : JoinedOrSeparate<["-","--"], "profiled-binary", [Show, Merge]>, + : JoinedOrSeparate<["--"], "profiled-binary", [Show, Merge]>, HelpText<"Path to binary from which the profile was collected.">, MetaVarName<"">; def debug_info - : JoinedOrSeparate<["-","--"], "debug-info", [Show, Merge]>, + : JoinedOrSeparate<["--"], "debug-info", [Show, Merge]>, HelpText<"For show, read and extract profile metadata from debug info. " "For merge, correlate the raw profile using the provided " "debug info.">, MetaVarName<"">; def binary_file - : JoinedOrSeparate<["-","--"], "binary-file", [Merge]>, + : JoinedOrSeparate<["--"], "binary-file", [Merge]>, HelpText<"Use the provided unstripped binary to correlate the raw " "profile.">, MetaVarName<"">; def debug_file_directory - : JoinedOrSeparate<["-","--"], "debug-file-directory", + : JoinedOrSeparate<["--"], "debug-file-directory", [Show, Order, Overlap, Merge]>, HelpText<"Directories to search for object files by build ID">, MetaVarName<"">; -def debuginfod : Flag<["-","--"], "debuginfod", [Merge]>, - HelpText<"Enable debuginfod">, Flags<[HelpHidden]>; -def correlate : JoinedOrSeparate<["-","--"], "correlate", +def debuginfod : Flag<["--"], "debuginfod", [Merge]>, + HelpText<"Enable debuginfod">; +def correlate : JoinedOrSeparate<["--"], "correlate", [Show, Order, Overlap, Merge]>, HelpText<"Use debug-info or binary correlation to correlate " "profiles with build id fetcher">, MetaVarName<"">; -def function : JoinedOrSeparate<["-","--"], "function", +def function : JoinedOrSeparate<["--"], "function", [Show, Overlap, Merge]>, HelpText<"Only functions matching the filter are shown or " "merged.">, MetaVarName<"">; def weighted_input - : JoinedOrSeparate<["-","--"], "weighted-input", [Merge]>, + : JoinedOrSeparate<["--"], "weighted-input", [Merge]>, HelpText<",">, MetaVarName<",">; -def binary : Flag<["-","--"], "binary", [Merge]>, +def binary : Flag<["--"], "binary", [Merge]>, HelpText<"Binary encoding">; -def extbinary : Flag<["-","--"], "extbinary", [Merge]>, +def extbinary : Flag<["--"], "extbinary", [Merge]>, HelpText<"Extensible binary encoding (default)">; -def text : Flag<["-","--"], "text", [Show, Merge]>, +def text : Flag<["--"], "text", [Show, Merge]>, HelpText<"Text output format">; -def gcc : Flag<["-","--"], "gcc", [Merge]>, +def gcc : Flag<["--"], "gcc", [Merge]>, HelpText<"GCC encoding (only meaningful for -sample)">; def input_files - : JoinedOrSeparate<["-","--"], "input-files", [Merge]>, + : JoinedOrSeparate<["--"], "input-files", [Merge]>, HelpText<"Path to file containing newline-separated " "[,] entries">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "f", [Merge]>, Alias, HelpText<"Alias for --input-files">; -def dump_input_file_list : Flag<["-","--"], "dump-input-file-list", [Merge]>, +def dump_input_file_list : Flag<["--"], "dump-input-file-list", [Merge]>, HelpText<"Dump the list of input files and their " - "weights, then exit">, - Flags<[HelpHidden]>; + "weights, then exit">; + def remapping_file - : JoinedOrSeparate<["-","--"], "remapping-file", [Merge]>, + : JoinedOrSeparate<["--"], "remapping-file", [Merge]>, HelpText<"Symbol remapping file">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "r", [Merge]>, Alias, HelpText<"Alias for --remapping-file">; -def use_md5 : Flag<["-","--"], "use-md5", [Merge]>, +def use_md5 : Flag<["--"], "use-md5", [Merge]>, HelpText<"Use MD5 to represent strings in the name table " - "(only meaningful for -extbinary)">, - Flags<[HelpHidden]>; + "(only meaningful for -extbinary)">; + def compress_all_sections - : Flag<["-","--"], "compress-all-sections", [Merge]>, - HelpText<"Compress all sections when writing the profile (only " - "meaningful for -extbinary)">, - Flags<[HelpHidden]>; -def compress_all_sections_EQ - : Joined<["-","--"], "compress-all-sections=", [Merge]>, + : Flag<["--"], "compress-all-sections", [Merge]>, HelpText<"Compress all sections when writing the profile (only " - "meaningful for -extbinary)">, - Flags<[HelpHidden]>; + "meaningful for -extbinary)">; + def sample_merge_cold_context - : Flag<["-","--"], "sample-merge-cold-context", [Merge]>, + : Flag<["--"], "sample-merge-cold-context", [Merge]>, HelpText<"Merge context sample profiles whose count is below cold " - "threshold">, - Flags<[HelpHidden]>; + "threshold">; + def sample_trim_cold_context - : Flag<["-","--"], "sample-trim-cold-context", [Merge]>, + : Flag<["--"], "sample-trim-cold-context", [Merge]>, HelpText<"Trim context sample profiles whose count is below cold " - "threshold">, - Flags<[HelpHidden]>; + "threshold">; + def sample_frame_depth_for_cold_context - : JoinedOrSeparate<["-","--"], "sample-frame-depth-for-cold-context", + : JoinedOrSeparate<["--"], "sample-frame-depth-for-cold-context", [Merge]>, HelpText<"Keep the last K frames while merging cold profile. 1 means " "the context-less base profile">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def output_size_limit - : JoinedOrSeparate<["-","--"], "output-size-limit", [Merge]>, + : JoinedOrSeparate<["--"], "output-size-limit", [Merge]>, HelpText<"Trim cold functions until profile size is below specified " "limit in bytes">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def gen_partial_profile - : Flag<["-","--"], "gen-partial-profile", [Merge]>, - HelpText<"Generate a partial profile (only meaningful for -extbinary)">, - Flags<[HelpHidden]>; -def split_layout : Flag<["-","--"], "split-layout", [Merge]>, + : Flag<["--"], "gen-partial-profile", [Merge]>, + HelpText<"Generate a partial profile (only meaningful for -extbinary)">; + +def split_layout : Flag<["--"], "split-layout", [Merge]>, HelpText<"Split the profile into sections with and without " "inlined functions (only meaningful for " - "-extbinary)">, - Flags<[HelpHidden]>; + "-extbinary)">; + def supplement_instr_with_sample - : JoinedOrSeparate<["-","--"], "supplement-instr-with-sample", [Merge]>, + : JoinedOrSeparate<["--"], "supplement-instr-with-sample", [Merge]>, HelpText<"Supplement an instr profile with a sample profile. Output " "will be in instr format.">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def zero_counter_threshold - : JoinedOrSeparate<["-","--"], "zero-counter-threshold", [Merge]>, + : JoinedOrSeparate<["--"], "zero-counter-threshold", [Merge]>, HelpText<"Ratio of zero counters required to drop a function when " "supplementing instr profiles">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def suppl_min_size_threshold - : JoinedOrSeparate<["-","--"], "suppl-min-size-threshold", [Merge]>, + : JoinedOrSeparate<["--"], "suppl-min-size-threshold", [Merge]>, HelpText<"Assume functions smaller than this threshold can be inlined " "and will not be adjusted based on sample profile.">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def instr_prof_cold_threshold - : JoinedOrSeparate<["-","--"], "instr-prof-cold-threshold", [Merge]>, + : JoinedOrSeparate<["--"], "instr-prof-cold-threshold", [Merge]>, HelpText<"User specified cold threshold for instr profile to override " "the cold threshold from profile summary.">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def temporal_profile_trace_reservoir_size - : JoinedOrSeparate<["-","--"], "temporal-profile-trace-reservoir-size", + : JoinedOrSeparate<["--"], "temporal-profile-trace-reservoir-size", [Merge]>, HelpText<"Maximum number of stored temporal profile traces (default: " "100)">, MetaVarName<"">; def temporal_profile_max_trace_length - : JoinedOrSeparate<["-","--"], "temporal-profile-max-trace-length", + : JoinedOrSeparate<["--"], "temporal-profile-max-trace-length", [Merge]>, HelpText<"Maximum length of a single temporal profile trace " "(default: 10000)">, MetaVarName<"">; -def no_function : JoinedOrSeparate<["-","--"], "no-function", [Merge]>, +def no_function : JoinedOrSeparate<["--"], "no-function", [Merge]>, HelpText<"Exclude functions matching the filter from the " "output.">, MetaVarName<"">; def failure_mode - : JoinedOrSeparate<["-","--"], "failure-mode", [Merge]>, + : JoinedOrSeparate<["--"], "failure-mode", [Merge]>, HelpText<"Failure mode: warn, any, or all">, MetaVarName<"">; def sparse - : Flag<["-","--"], "sparse", [Merge]>, + : Flag<["--"], "sparse", [Merge]>, HelpText<"Generate a sparse profile (only meaningful for -instr)">; -def sparse_EQ - : Joined<["-","--"], "sparse=", [Merge]>, - HelpText<"Generate a sparse profile (only meaningful for -instr)">, - Flags<[HelpHidden]>; -def profile_isfs : Flag<["-","--"], "profile-isfs", [Show, Merge]>, - HelpText<"Profile uses flow-sensitive discriminators">, - Flags<[HelpHidden]>; +def profile_isfs : Flag<["--"], "profile-isfs", [Show, Merge]>, + HelpText<"Profile uses flow-sensitive discriminators">; + def generate_merged_base_profiles - : JoinedOrSeparate<["-","--"], "generate-merged-base-profiles", [Merge]>, + : Flag<["--"], "generate-merged-base-profiles", [Merge]>, HelpText<"Generate merged base profiles when creating nested " - "context-sensitive profiles">, - Flags<[HelpHidden]>; + "context-sensitive profiles">; + def profile_symbol_list_cutoff - : JoinedOrSeparate<["-","--"], "profile-symbol-list-cutoff", [Merge]>, - HelpText<"Maximum number of symbols to keep in the profile symbol list">, - Flags<[HelpHidden]>; + : JoinedOrSeparate<["--"], "profile-symbol-list-cutoff", [Merge]>, + HelpText<"Maximum number of symbols to keep in the profile symbol list">; + def profile_summary_cutoff_hot - : JoinedOrSeparate<["-","--"], "profile-summary-cutoff-hot", + : JoinedOrSeparate<["--"], "profile-summary-cutoff-hot", [Show, Merge]>, - HelpText<"Percentile (times 10000) for determining hot threshold">, - Flags<[HelpHidden]>; + HelpText<"Percentile (times 10000) for determining hot threshold">; + def profile_summary_cutoff_cold - : JoinedOrSeparate<["-","--"], "profile-summary-cutoff-cold", + : JoinedOrSeparate<["--"], "profile-summary-cutoff-cold", [Show, Merge]>, - HelpText<"Percentile (times 10000) for determining cold threshold">, - Flags<[HelpHidden]>; + HelpText<"Percentile (times 10000) for determining cold threshold">; + def profile_summary_hot_count - : JoinedOrSeparate<["-","--"], "profile-summary-hot-count", + : JoinedOrSeparate<["--"], "profile-summary-hot-count", [Show, Merge]>, - HelpText<"Override hot count derived from summary cutoffs">, - Flags<[HelpHidden]>; + HelpText<"Override hot count derived from summary cutoffs">; + def profile_summary_cold_count - : JoinedOrSeparate<["-","--"], "profile-summary-cold-count", + : JoinedOrSeparate<["--"], "profile-summary-cold-count", [Show, Merge]>, - HelpText<"Override cold count derived from summary cutoffs">, - Flags<[HelpHidden]>; + HelpText<"Override cold count derived from summary cutoffs">; + def profile_summary_contextless - : JoinedOrSeparate<["-","--"], "profile-summary-contextless", + : JoinedOrSeparate<["--"], "profile-summary-contextless", [Show, Merge]>, - HelpText<"Merge context profiles before calculating summary thresholds">, - Flags<[HelpHidden]>; + HelpText<"Merge context profiles before calculating summary thresholds">; + def profile_summary_huge_working_set_size_threshold - : JoinedOrSeparate<["-","--"], + : JoinedOrSeparate<["--"], "profile-summary-huge-working-set-size-threshold", [Show, Merge]>, - HelpText<"Threshold for huge working set size used in profile summary">, - Flags<[HelpHidden]>; + HelpText<"Threshold for huge working set size used in profile summary">; + def profile_summary_large_working_set_size_threshold - : JoinedOrSeparate<["-","--"], + : JoinedOrSeparate<["--"], "profile-summary-large-working-set-size-threshold", [Show, Merge]>, - HelpText<"Threshold for large working set size used in profile summary">, - Flags<[HelpHidden]>; -def num_threads : JoinedOrSeparate<["-","--"], "num-threads", [Merge]>, + HelpText<"Threshold for large working set size used in profile summary">; + +def num_threads : JoinedOrSeparate<["--"], "num-threads", [Merge]>, HelpText<"Number of merge threads to use (default: autodetect)">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "j", [Merge]>, Alias, HelpText<"Alias for --num-threads">; def prof_sym_list - : JoinedOrSeparate<["-","--"], "prof-sym-list", [Merge]>, + : JoinedOrSeparate<["--"], "prof-sym-list", [Merge]>, HelpText<"Path to file containing the list of function symbols used to " "populate profile symbol list">, MetaVarName<"">; def convert_sample_profile_layout - : JoinedOrSeparate<["-","--"], "convert-sample-profile-layout", [Merge]>, + : JoinedOrSeparate<["--"], "convert-sample-profile-layout", [Merge]>, HelpText<"Convert the generated profile to a new layout: nest or flat">, MetaVarName<"">; def drop_profile_symbol_list - : Flag<["-","--"], "drop-profile-symbol-list", [Merge]>, + : Flag<["--"], "drop-profile-symbol-list", [Merge]>, HelpText<"Drop the profile symbol list when merging AutoFDO profiles " - "(only meaningful for -sample)">, - Flags<[HelpHidden]>; + "(only meaningful for -sample)">; + def keep_vtable_symbols - : Flag<["-","--"], "keep-vtable-symbols", [Merge]>, - HelpText<"Keep the vtable symbols in indexed profiles">, - Flags<[HelpHidden]>; + : Flag<["--"], "keep-vtable-symbols", [Merge]>, + HelpText<"Keep the vtable symbols in indexed profiles">; + def write_prev_version - : Flag<["-","--"], "write-prev-version", [Merge]>, + : Flag<["--"], "write-prev-version", [Merge]>, HelpText<"Write the previous version of indexed format for forward " - "compatibility.">, - Flags<[HelpHidden]>; + "compatibility.">; + def memprof_version - : JoinedOrSeparate<["-","--"], "memprof-version", [Merge]>, + : JoinedOrSeparate<["--"], "memprof-version", [Merge]>, HelpText<"Specify the version of the memprof format to use (2, 3, or 4)">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def memprof_full_schema - : Flag<["-","--"], "memprof-full-schema", [Merge]>, - HelpText<"Use the full schema for serialization">, - Flags<[HelpHidden]>; + : Flag<["--"], "memprof-full-schema", [Merge]>, + HelpText<"Use the full schema for serialization">; + def memprof_random_hotness - : Flag<["-","--"], "memprof-random-hotness", [Merge]>, - HelpText<"Generate random hotness values">, - Flags<[HelpHidden]>; + : Flag<["--"], "memprof-random-hotness", [Merge]>, + HelpText<"Generate random hotness values">; + def memprof_random_hotness_seed - : JoinedOrSeparate<["-","--"], "memprof-random-hotness-seed", [Merge]>, + : JoinedOrSeparate<["--"], "memprof-random-hotness-seed", [Merge]>, HelpText<"Random hotness seed to use (0 to generate new seed)">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; def similarity_cutoff - : JoinedOrSeparate<["-","--"], "similarity-cutoff", [Overlap]>, + : JoinedOrSeparate<["--"], "similarity-cutoff", [Overlap]>, HelpText<"List overlapped functions with similarities below the cutoff " "(percentage times 10000).">, MetaVarName<"">; -def cs : Flag<["-","--"], "cs", [Overlap]>, +def cs : Flag<["--"], "cs", [Overlap]>, HelpText<"For context sensitive PGO counts. Does not work with " "CSSPGO.">; def value_cutoff - : JoinedOrSeparate<["-","--"], "value-cutoff", [Show, Overlap]>, + : JoinedOrSeparate<["--"], "value-cutoff", [Show, Overlap]>, HelpText<"Cutoff value used for filtering. Meaning depends on subcommand">, MetaVarName<"">; -def counts : Flag<["-","--"], "counts", [Show]>, +def counts : Flag<["--"], "counts", [Show]>, HelpText<"Show counter values for shown functions">; def show_format - : JoinedOrSeparate<["-","--"], "show-format", [Show]>, + : JoinedOrSeparate<["--"], "show-format", [Show]>, HelpText<"Emit output in the selected format: text, json, or yaml">, MetaVarName<"">; -def json : Flag<["-","--"], "json", [Show]>, +def json : Flag<["--"], "json", [Show]>, HelpText<"Show sample profile data in JSON format " "(deprecated, use --show-format=json)">; -def ic_targets : Flag<["-","--"], "ic-targets", [Show]>, +def ic_targets : Flag<["--"], "ic-targets", [Show]>, HelpText<"Show indirect call site target values">; -def show_vtables : Flag<["-","--"], "show-vtables", [Show]>, +def show_vtables : Flag<["--"], "show-vtables", [Show]>, HelpText<"Show vtable names for shown functions">; def extbinary_write_vtable_type_prof - : Flag<["-","--"], "extbinary-write-vtable-type-prof", [Merge]>, - HelpText<"Include vtable type profile data in ext-binary sample profile">, - Flags<[HelpHidden]>; -def memop_sizes : Flag<["-","--"], "memop-sizes", [Show]>, + : Flag<["--"], "extbinary-write-vtable-type-prof", [Merge]>, + HelpText<"Include vtable type profile data in ext-binary sample profile">; + +def memop_sizes : Flag<["--"], "memop-sizes", [Show]>, HelpText<"Show profiled sizes of memory intrinsic calls">; -def detailed_summary : Flag<["-","--"], "detailed-summary", [Show]>, +def detailed_summary : Flag<["--"], "detailed-summary", [Show]>, HelpText<"Show detailed profile summary">; def detailed_summary_cutoffs - : CommaJoined<["-","--"], "detailed-summary-cutoffs", [Show]>, + : JoinedOrSeparate<["--"], "detailed-summary-cutoffs", [Show]>, HelpText<"Cutoff percentages (times 10000) for generating detailed " "summary">, MetaVarName<"">; -def hot_func_list : Flag<["-","--"], "hot-func-list", [Show]>, +def hot_func_list : Flag<["--"], "hot-func-list", [Show]>, HelpText<"Show profile summary of a list of hot functions">; -def all_functions : Flag<["-","--"], "all-functions", [Show]>, +def all_functions : Flag<["--"], "all-functions", [Show]>, HelpText<"Details for each and every function">; -def showcs : Flag<["-","--"], "showcs", [Show]>, +def showcs : Flag<["--"], "showcs", [Show]>, HelpText<"Show context sensitive counts">; -def topn : JoinedOrSeparate<["-","--"], "topn", [Show]>, +def topn : JoinedOrSeparate<["--"], "topn", [Show]>, HelpText<"Show the list of functions with the largest internal counts">, MetaVarName<"">; def list_below_cutoff - : Flag<["-","--"], "list-below-cutoff", [Show]>, + : Flag<["--"], "list-below-cutoff", [Show]>, HelpText<"Only output names of functions whose max count values are " "below the cutoff value">; def show_prof_sym_list - : Flag<["-","--"], "show-prof-sym-list", [Show]>, + : Flag<["--"], "show-prof-sym-list", [Show]>, HelpText<"Show profile symbol list if it exists in the profile.">; def show_sec_info_only - : Flag<["-","--"], "show-sec-info-only", [Show]>, + : Flag<["--"], "show-sec-info-only", [Show]>, HelpText<"Show the information of each section in the sample profile " "(extbinary sample profiles only)">; -def binary_ids : Flag<["-","--"], "binary-ids", [Show]>, +def binary_ids : Flag<["--"], "binary-ids", [Show]>, HelpText<"Show binary ids in the profile.">; def temporal_profile_traces - : Flag<["-","--"], "temporal-profile-traces", [Show]>, + : Flag<["--"], "temporal-profile-traces", [Show]>, HelpText<"Show temporal profile traces in the profile.">; -def covered : Flag<["-","--"], "covered", [Show]>, +def covered : Flag<["--"], "covered", [Show]>, HelpText<"Show only the functions that have been executed.">; -def profile_version : Flag<["-","--"], "profile-version", [Show]>, +def profile_version : Flag<["--"], "profile-version", [Show]>, HelpText<"Show profile version.">; def num_test_traces - : JoinedOrSeparate<["-","--"], "num-test-traces", [Order]>, + : JoinedOrSeparate<["--"], "num-test-traces", [Order]>, HelpText<"Keep aside the last traces when computing " "function order to evaluate that order">, MetaVarName<"">; def fs_discriminator_pass - : JoinedOrSeparate<["-","--"], "fs-discriminator-pass", + : JoinedOrSeparate<["--"], "fs-discriminator-pass", [Show, Overlap, Merge]>, HelpText<"Zero out the discriminator bits for the FS discriminator " "pass beyond this value.">, - Flags<[HelpHidden]>, MetaVarName<"">; + MetaVarName<"">; diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 5215578eede46..24fb96a1ce519 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -58,8 +58,6 @@ #include #include -#include "Opts.inc" - using namespace llvm; using namespace llvm::opt; using ProfCorrelatorKind = InstrProfCorrelator::ProfCorrelatorKind; @@ -609,11 +607,13 @@ getFuncName(const StringMap::value_type &Val) { return Val.first(); } -static std::string getFuncName(const SampleProfileMap::value_type &Val) { +static std::string +getFuncName(const SampleProfileMap::value_type &Val) { return Val.second.getContext().toString(); } -template static void filterFunctions(T &ProfileMap) { +template +static void filterFunctions(T &ProfileMap) { bool hasFilter = !FuncNameFilter.empty(); bool hasNegativeFilter = !FuncNameNegativeFilter.empty(); if (!hasFilter && !hasNegativeFilter) @@ -1201,8 +1201,8 @@ remapSamples(const sampleprof::FunctionSamples &Samples, BodySample.second.getSamples()); for (const auto &Target : BodySample.second.getCallTargets()) { Result.addCalledTargetSamples(BodySample.first.LineOffset, - MaskedDiscriminator, Remapper(Target.first), - Target.second); + MaskedDiscriminator, + Remapper(Target.first), Target.second); } } for (const auto &CallsiteSamples : Samples.getCallsiteSamples()) { @@ -1219,8 +1219,12 @@ remapSamples(const sampleprof::FunctionSamples &Samples, } static sampleprof::SampleProfileFormat FormatMap[] = { - sampleprof::SPF_None, sampleprof::SPF_Text, sampleprof::SPF_None, - sampleprof::SPF_Ext_Binary, sampleprof::SPF_GCC, sampleprof::SPF_Binary}; + sampleprof::SPF_None, + sampleprof::SPF_Text, + sampleprof::SPF_None, + sampleprof::SPF_Ext_Binary, + sampleprof::SPF_GCC, + sampleprof::SPF_Binary}; static std::unique_ptr getInputFileBuf(const StringRef &InputFile) { @@ -1479,7 +1483,8 @@ static int merge_main(StringRef ProgName) { parseInputFilenamesFile(Buffer.get(), WeightedInputs); if (WeightedInputs.empty()) - exitWithError("no input files specified. See " + ProgName + " merge -help"); + exitWithError("no input files specified. See " + ProgName + + " merge --help"); if (DumpInputFileList) { for (auto &WF : WeightedInputs) @@ -3068,8 +3073,9 @@ static int showDebugInfoCorrelation(const std::string &Filename, static int show_main(StringRef ProgName) { if (Filename.empty() && DebugInfoFilename.empty()) - exitWithError("the positional argument '' is required " - "unless '--debug-info' is provided"); + exitWithError( + "the positional argument '' is required unless " + "'--debug-info' is provided"); if (Filename == OutputFilename) { errs() << ProgName @@ -3086,8 +3092,7 @@ static int show_main(StringRef ProgName) { exitWithErrorCode(EC, OutputFilename); if (ShowAllFunctions && !FuncNameFilter.empty()) - WithColor::warning() - << "-function argument ignored: showing all functions\n"; + WithColor::warning() << "-function argument ignored: showing all functions\n"; if (!DebugInfoFilename.empty()) return showDebugInfoCorrelation(DebugInfoFilename, SFormat, OS); @@ -3168,56 +3173,11 @@ static void reportCmdLineError(const Twine &Message) { WithColor::error(errs(), ProgramName) << Message << "\n"; } -static StringRef getOptionValue(const opt::Arg *A) { - if (A->getNumValues() == 0) - return StringRef(); - StringRef V = A->getValue(); - V.consume_front("="); - return V; -} - -static std::string getLastArgValueClean(const opt::InputArgList &Args, - unsigned OptionID, - StringRef Default = "") { - if (const opt::Arg *A = Args.getLastArg(OptionID)) - return getOptionValue(A).str(); - return Default.str(); -} - -static std::vector -getAllArgValuesClean(const opt::InputArgList &Args, unsigned OptionID) { - std::vector Values; - for (const opt::Arg *A : Args.filtered(OptionID)) - Values.push_back(getOptionValue(A).str()); - return Values; -} - -static bool parseBooleanOption(const opt::Arg *A, bool &Value) { - if (!A) - return true; - StringRef V = getOptionValue(A); - if (V.empty()) { - Value = true; - return true; - } - if (V.equals_insensitive("true") || V == "1") { - Value = true; - return true; - } - if (V.equals_insensitive("false") || V == "0") { - Value = false; - return true; - } - reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + - A->getSpelling() + "'"); - return false; -} - template static bool parseNumericOption(const opt::Arg *A, T &Value) { if (!A) return true; - StringRef V = getOptionValue(A); + StringRef V = A->getValue(); T Parsed{}; if (!llvm::to_integer(V, Parsed, 0)) { if (!std::numeric_limits::is_signed && V == "-1") { @@ -3232,19 +3192,13 @@ static bool parseNumericOption(const opt::Arg *A, T &Value) { return true; } -static bool applyLibraryOptionsWithCL(const opt::InputArgList &Args) { +static bool applyLibraryOptions(const opt::InputArgList &Args) { SmallVector CLStrings; CLStrings.push_back(ProgramName); - auto AddBool = [&](unsigned OptID, StringRef Spelling) -> bool { - if (const opt::Arg *A = Args.getLastArg(OptID)) { - bool Value = true; - if (!parseBooleanOption(A, Value)) - return false; - CLStrings.push_back( - (Spelling + Twine("=") + (Value ? "true" : "false")).str()); - } - return true; + auto AddFlag = [&](unsigned OptID, StringRef Spelling) { + if (Args.hasArg(OptID)) + CLStrings.push_back(Spelling.str()); }; auto AddUInt = [&](unsigned OptID, StringRef Spelling) -> bool { if (const opt::Arg *A = Args.getLastArg(OptID)) { @@ -3265,20 +3219,14 @@ static bool applyLibraryOptionsWithCL(const opt::InputArgList &Args) { return true; }; - if (!AddBool(OPT_profile_isfs, "--profile-isfs")) - return false; - if (!AddBool(OPT_generate_merged_base_profiles, - "--generate-merged-base-profiles")) - return false; + AddFlag(OPT_profile_isfs, "--profile-isfs"); + AddFlag(OPT_generate_merged_base_profiles, "--generate-merged-base-profiles"); if (!AddUInt(OPT_profile_symbol_list_cutoff, "--profile-symbol-list-cutoff")) return false; - if (!AddBool(OPT_extbinary_write_vtable_type_prof, - "--extbinary-write-vtable-type-prof")) - return false; + AddFlag(OPT_extbinary_write_vtable_type_prof, + "--extbinary-write-vtable-type-prof"); - if (!AddBool(OPT_profile_summary_contextless, - "--profile-summary-contextless")) - return false; + AddFlag(OPT_profile_summary_contextless, "--profile-summary-contextless"); if (!AddInt(OPT_profile_summary_cutoff_hot, "--profile-summary-cutoff-hot")) return false; if (!AddInt(OPT_profile_summary_cutoff_cold, "--profile-summary-cutoff-cold")) @@ -3311,7 +3259,7 @@ static bool applyLibraryOptionsWithCL(const opt::InputArgList &Args) { static bool parseFloatOption(const opt::Arg *A, float &Value) { if (!A) return true; - StringRef V = getOptionValue(A); + StringRef V = A->getValue(); double Parsed; if (V.getAsDouble(Parsed)) { reportCmdLineError(Twine("invalid argument '") + V + "' for option '" + @@ -3327,17 +3275,9 @@ static bool parseCutoffValues(const opt::InputArgList &Args, Cutoffs.clear(); for (const opt::Arg *A : Args.filtered(OPT_detailed_summary_cutoffs)) { SmallVector Parts; - if (A->getNumValues() <= 1) { - getOptionValue(A).split(Parts, ',', /*MaxSplit=*/-1, - /*KeepEmpty=*/false); - } else { - for (unsigned I = 0, E = A->getNumValues(); I != E; ++I) { - StringRef Part = A->getValue(I); - if (!Part.empty() && Part.front() == '=') - Part = Part.drop_front(); - Parts.push_back(Part); - } - } + StringRef(A->getValue()) + .split(Parts, ',', /*MaxSplit=*/-1, + /*KeepEmpty=*/false); for (StringRef Part : Parts) { uint32_t Parsed; if (!llvm::to_integer(Part, Parsed, 0)) { @@ -3356,7 +3296,7 @@ static bool parseFSDiscriminatorPassArg(const opt::InputArgList &Args) { if (!A) return true; - StringRef Value = getOptionValue(A); + StringRef Value = A->getValue(); auto Parsed = StringSwitch>(Value) .Case("Base", FSDiscriminatorPass::Base) .Case("base", FSDiscriminatorPass::Base) @@ -3386,6 +3326,9 @@ static bool validateSubcommandOptions(const opt::InputArgList &Args, if (A->getOption().matches(OPT_UNKNOWN) || A->getOption().matches(OPT_INPUT)) continue; + // Options without an explicit subcommand are available everywhere. + if (A->getOption().matches(OPT_help) || A->getOption().matches(OPT_version)) + continue; if (A->getOption().isRegisteredSC(Subcommand)) continue; reportCmdLineError(Twine("unknown command line argument '") + @@ -3399,24 +3342,24 @@ static bool validateSubcommandOptions(const opt::InputArgList &Args, static bool parseMergeOptions(const opt::InputArgList &Args, ArrayRef Positionals) { - OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; - if (!applyLibraryOptionsWithCL(Args)) + if (!applyLibraryOptions(Args)) return false; if (!parseNumericOption( Args.getLastArg(OPT_max_debug_info_correlation_warnings), MaxDbgCorrelationWarnings)) return false; - ProfiledBinary = getLastArgValueClean(Args, OPT_profiled_binary); - DebugInfoFilename = getLastArgValueClean(Args, OPT_debug_info); - BinaryFilename = getLastArgValueClean(Args, OPT_binary_file); - DebugFileDirectory = getAllArgValuesClean(Args, OPT_debug_file_directory); + ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); + DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); + BinaryFilename = Args.getLastArgValue(OPT_binary_file).str(); + DebugFileDirectory = Args.getAllArgValues(OPT_debug_file_directory); DebugInfod = Args.hasArg(OPT_debuginfod); if (const opt::Arg *A = Args.getLastArg(OPT_correlate)) { - StringRef V = getOptionValue(A); + StringRef V = A->getValue(); auto Parsed = StringSwitch>(V) .Case("", InstrProfCorrelator::NONE) .Case("debug-info", InstrProfCorrelator::DEBUG_INFO) @@ -3430,12 +3373,12 @@ static bool parseMergeOptions(const opt::InputArgList &Args, BIDFetcherProfileCorrelate = *Parsed; } - FuncNameFilter = getLastArgValueClean(Args, OPT_function); + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); InputFilenames.clear(); InputFilenames.reserve(Positionals.size()); for (StringRef Pos : Positionals) InputFilenames.emplace_back(Pos.str()); - WeightedInputFilenames = getAllArgValuesClean(Args, OPT_weighted_input); + WeightedInputFilenames = Args.getAllArgValues(OPT_weighted_input); OutputFormat = PF_Ext_Binary; if (const opt::Arg *Fmt = @@ -3450,15 +3393,11 @@ static bool parseMergeOptions(const opt::InputArgList &Args, OutputFormat = PF_Ext_Binary; } - InputFilenamesFile = getLastArgValueClean(Args, OPT_input_files); + InputFilenamesFile = Args.getLastArgValue(OPT_input_files).str(); DumpInputFileList = Args.hasArg(OPT_dump_input_file_list); - RemappingFile = getLastArgValueClean(Args, OPT_remapping_file); + RemappingFile = Args.getLastArgValue(OPT_remapping_file).str(); UseMD5 = Args.hasArg(OPT_use_md5); - const opt::Arg *CompressArg = - Args.getLastArg(OPT_compress_all_sections, OPT_compress_all_sections_EQ); - CompressAllSections = CompressArg != nullptr; - if (!parseBooleanOption(CompressArg, CompressAllSections)) - return false; + CompressAllSections = Args.hasArg(OPT_compress_all_sections); SampleMergeColdContext = Args.hasArg(OPT_sample_merge_cold_context); SampleTrimColdContext = Args.hasArg(OPT_sample_trim_cold_context); if (!parseNumericOption( @@ -3471,7 +3410,7 @@ static bool parseMergeOptions(const opt::InputArgList &Args, GenPartialProfile = Args.hasArg(OPT_gen_partial_profile); SplitLayout = Args.hasArg(OPT_split_layout); SupplInstrWithSample = - getLastArgValueClean(Args, OPT_supplement_instr_with_sample); + Args.getLastArgValue(OPT_supplement_instr_with_sample).str(); if (!parseFloatOption(Args.getLastArg(OPT_zero_counter_threshold), ZeroCounterThreshold)) return false; @@ -3489,12 +3428,9 @@ static bool parseMergeOptions(const opt::InputArgList &Args, Args.getLastArg(OPT_temporal_profile_max_trace_length), TemporalProfMaxTraceLength)) return false; - FuncNameNegativeFilter = getLastArgValueClean(Args, OPT_no_function); + FuncNameNegativeFilter = Args.getLastArgValue(OPT_no_function).str(); - StringRef FailureModeValue = - Args.getLastArg(OPT_failure_mode) - ? getOptionValue(Args.getLastArg(OPT_failure_mode)) - : StringRef("any"); + StringRef FailureModeValue = Args.getLastArgValue(OPT_failure_mode, "any"); auto ParsedFailMode = StringSwitch>(FailureModeValue) .Case("warn", warnOnly) @@ -3508,16 +3444,13 @@ static bool parseMergeOptions(const opt::InputArgList &Args, } FailMode = *ParsedFailMode; - const opt::Arg *SparseArg = Args.getLastArg(OPT_sparse, OPT_sparse_EQ); - OutputSparse = SparseArg != nullptr; - if (!parseBooleanOption(SparseArg, OutputSparse)) - return false; + OutputSparse = Args.hasArg(OPT_sparse); if (!parseNumericOption(Args.getLastArg(OPT_num_threads), NumThreads)) return false; - ProfileSymbolListFile = getLastArgValueClean(Args, OPT_prof_sym_list); + ProfileSymbolListFile = Args.getLastArgValue(OPT_prof_sym_list).str(); if (const opt::Arg *A = Args.getLastArg(OPT_convert_sample_profile_layout)) { - StringRef Layout = getOptionValue(A); + StringRef Layout = A->getValue(); auto ParsedLayout = StringSwitch>(Layout) .Case("nest", SPL_Nest) .Case("flat", SPL_Flat) @@ -3535,7 +3468,7 @@ static bool parseMergeOptions(const opt::InputArgList &Args, DoWritePrevVersion = Args.hasArg(OPT_write_prev_version); if (const opt::Arg *A = Args.getLastArg(OPT_memprof_version)) { - StringRef Version = getOptionValue(A); + StringRef Version = A->getValue(); auto ParsedVersion = StringSwitch>(Version) .Case("2", memprof::Version2) @@ -3564,7 +3497,10 @@ static bool parseMergeOptions(const opt::InputArgList &Args, static bool parseShowOptions(const opt::InputArgList &Args, ArrayRef Positionals) { - OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); + DebugInfoFilename = Args.getLastArgValue(OPT_debug_info).str(); + ProfiledBinary = Args.getLastArgValue(OPT_profiled_binary).str(); + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); if (!Positionals.empty()) { Filename = Positionals.front().str(); if (Positionals.size() > 1) { @@ -3572,20 +3508,28 @@ static bool parseShowOptions(const opt::InputArgList &Args, return false; } } + if (Filename.empty() && DebugInfoFilename.empty()) { + reportCmdLineError( + "the positional argument '' is required unless " + "'--debug-info' is provided"); + return false; + } + if (!Filename.empty() && OutputFilename == Filename) { + reportCmdLineError("show: Input file name cannot be the same as the " + "output file name!"); + return false; + } if (!parseNumericOption( Args.getLastArg(OPT_max_debug_info_correlation_warnings), MaxDbgCorrelationWarnings)) return false; - if (!applyLibraryOptionsWithCL(Args)) + if (!applyLibraryOptions(Args)) return false; - ProfiledBinary = getLastArgValueClean(Args, OPT_profiled_binary); - DebugInfoFilename = getLastArgValueClean(Args, OPT_debug_info); - FuncNameFilter = getLastArgValueClean(Args, OPT_function); ShowCounts = Args.hasArg(OPT_counts); if (const opt::Arg *A = Args.getLastArg(OPT_show_format)) { - StringRef Value = getOptionValue(A); + StringRef Value = A->getValue(); auto Parsed = StringSwitch>(Value) .Case("text", ShowFormat::Text) .Case("json", ShowFormat::Json) @@ -3638,7 +3582,7 @@ static bool parseShowOptions(const opt::InputArgList &Args, static bool parseOverlapOptions(const opt::InputArgList &Args, ArrayRef Positionals) { - OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); if (Positionals.size() != 2) { reportCmdLineError("overlap requires two positional profile filenames"); return false; @@ -3649,7 +3593,7 @@ static bool parseOverlapOptions(const opt::InputArgList &Args, if (const opt::Arg *A = Args.getLastArg(OPT_sample, OPT_instr)) ProfileKind = A->getOption().matches(OPT_sample) ? sample : instr; - FuncNameFilter = getLastArgValueClean(Args, OPT_function); + FuncNameFilter = Args.getLastArgValue(OPT_function).str(); if (!parseNumericOption(Args.getLastArg(OPT_similarity_cutoff), SimilarityCutoff)) return false; @@ -3666,7 +3610,7 @@ static bool parseOverlapOptions(const opt::InputArgList &Args, static bool parseOrderOptions(const opt::InputArgList &Args, ArrayRef Positionals) { - OutputFilename = getLastArgValueClean(Args, OPT_output, "-"); + OutputFilename = Args.getLastArgValue(OPT_output, "-").str(); if (!Positionals.empty()) { Filename = Positionals.front().str(); if (Positionals.size() > 1) { @@ -3686,47 +3630,8 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { ProgramName = sys::path::stem(argv[0]).str(); ProfdataOptTable Tbl; - ArrayRef KnownSubcommands = Tbl.getSubCommands(); - auto IsKnownSubcommand = [&](StringRef Name) { - return llvm::any_of( - KnownSubcommands, - [&](const opt::OptTable::SubCommand &SC) { return Name == SC.Name; }); - }; - ArrayRef RawArgs(argv + 1, argv + argc); - SmallVector RawSubcommands; - for (const char *Arg : RawArgs) { - StringRef ArgRef(Arg); - if (!ArgRef.starts_with("-") && IsKnownSubcommand(ArgRef)) - RawSubcommands.push_back(ArgRef); - } - auto HasFlag = [&](StringRef Flag) { - return llvm::is_contained(RawArgs, Flag); - }; - auto HasAnySubcommand = [&]() { return !RawSubcommands.empty(); }; - - if (!HasAnySubcommand()) { - if (HasFlag("--help") || HasFlag("-help") || HasFlag("-h")) { - std::string Usage = ProgramName + " [subcommand] [options]"; - Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", - /*ShowHidden=*/false, /*ShowAllAliases=*/false, - Visibility(), /*Subcommand=*/{}); - return 0; - } - if (HasFlag("--help-hidden")) { - std::string Usage = ProgramName + " [subcommand] [options]"; - Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", - /*ShowHidden=*/true, /*ShowAllAliases=*/false, Visibility(), - /*Subcommand=*/{}); - return 0; - } - if (HasFlag("--version") || HasFlag("-version")) { - outs() << ProgramName << '\n'; - cl::PrintVersionMessage(); - return 0; - } - } - if (argc <= 1) { + if (argc == 1) { errs() << ProgramName << ": No subcommand specified! Run " << ProgramName << " --help for usage.\n"; return 1; @@ -3734,7 +3639,7 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { bool HadParseError = false; opt::InputArgList Args = - Tbl.parseArgs(argc - 1, argv + 1, OPT_UNKNOWN, Saver, [&](StringRef Msg) { + Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) { WithColor::error(errs(), ProgramName) << Msg << "\n"; HadParseError = true; }); @@ -3748,83 +3653,64 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { WithColor::error(errs(), ProgramName) << "multiple subcommands specified:"; for (StringRef SC : SubCommands) errs() << " '" << SC << "'"; - errs() << ".\n"; + errs() << "\n"; }; auto HandleOtherPositionals = [&](ArrayRef Positionals) { OtherPositionals.append(Positionals.begin(), Positionals.end()); }; + auto IsKnownSubcommand = [&](StringRef Name) { + return llvm::any_of( + Tbl.getSubCommands(), + [&](const opt::OptTable::SubCommand &SC) { return Name == SC.Name; }); + }; + + StringRef RawFirstArg = argc > 1 ? StringRef(argv[1]) : StringRef(); + StringRef RawSubcommand = + IsKnownSubcommand(RawFirstArg) ? RawFirstArg : StringRef(); + StringRef Subcommand = Args.getSubCommand( Tbl.getSubCommands(), HandleMultipleSubcommands, HandleOtherPositionals); if (HadSubcommandError) return 1; - if (Subcommand.empty() && RawSubcommands.size() > 1) { - HadSubcommandError = true; - HandleMultipleSubcommands(RawSubcommands); - } - if (HadSubcommandError) - return 1; - - if (Subcommand.empty() && argc > 1 && IsKnownSubcommand(argv[1])) - Subcommand = argv[1]; if (Subcommand.empty() && !OtherPositionals.empty() && IsKnownSubcommand(OtherPositionals.front())) { Subcommand = OtherPositionals.front(); OtherPositionals.erase(OtherPositionals.begin()); } - if (Subcommand.empty() && RawSubcommands.size() == 1) - Subcommand = RawSubcommands.front(); - if (!Subcommand.empty()) { + if (Subcommand.empty() && !RawSubcommand.empty()) { + Subcommand = RawSubcommand; auto It = llvm::find(OtherPositionals, Subcommand); if (It != OtherPositionals.end()) OtherPositionals.erase(It); } - ArrayRef Positionals = OtherPositionals; - - bool ShowHidden = Args.hasArg(OPT_help_hidden); - if (Args.hasArg(OPT_help) || ShowHidden) { + if (Args.hasArg(OPT_help)) { std::string Usage = ProgramName + " [subcommand] [options]"; Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", - /*ShowHidden=*/ShowHidden, /*ShowAllAliases=*/false, - Visibility(), Subcommand); + /*ShowHidden=*/false, /*ShowAllAliases=*/false, Visibility(), + Subcommand); + return 0; + } + + if (Args.hasArg(OPT_version)) { + outs() << ProgramName << '\n'; + cl::PrintVersionMessage(); return 0; } if (Subcommand.empty()) { - if (Args.hasArg(OPT_version)) { - outs() << ProgramName << '\n'; - cl::PrintVersionMessage(); - return 0; - } - if (!OtherPositionals.empty()) { - WithColor::error(errs(), ProgramName) << "Unknown command"; - if (OtherPositionals.size() != 1) - errs() << "s"; - errs() << " "; - for (size_t I = 0; I < OtherPositionals.size(); ++I) { - if (I) - errs() << ", "; - errs() << "'" << OtherPositionals[I] << "'"; - } - errs() << ". Run " << ProgramName << " --help for usage.\n"; - } else { - errs() << ProgramName << ": No subcommand specified! Run " << ProgramName - << " --help for usage.\n"; - } + errs() << ProgramName << ": No subcommand specified! Run " << ProgramName + << " --help for usage.\n"; return 1; } + ArrayRef Positionals = OtherPositionals; + if (!validateSubcommandOptions(Args, Subcommand)) return 1; - if (Args.hasArg(OPT_version)) { - outs() << ProgramName << '\n'; - cl::PrintVersionMessage(); - return 0; - } - if (Subcommand == "merge") { if (!parseMergeOptions(Args, Positionals)) return 1; From cf7125232d648c0e7dea3bc9cc43b4a9804aca4d Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sun, 15 Feb 2026 09:04:38 -0500 Subject: [PATCH 4/6] CR feedback --- llvm/tools/llvm-profdata/llvm-profdata.cpp | 59 +++++++++------------- 1 file changed, 25 insertions(+), 34 deletions(-) diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 24fb96a1ce519..4d6a936773897 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -47,7 +47,6 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/Regex.h" -#include "llvm/Support/StringSaver.h" #include "llvm/Support/ThreadPool.h" #include "llvm/Support/Threading.h" #include "llvm/Support/VirtualFileSystem.h" @@ -3624,9 +3623,6 @@ static bool parseOrderOptions(const opt::InputArgList &Args, } int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { - BumpPtrAllocator Alloc; - StringSaver Saver(Alloc); - ProgramName = sys::path::stem(argv[0]).str(); ProfdataOptTable Tbl; @@ -3637,15 +3633,6 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { return 1; } - bool HadParseError = false; - opt::InputArgList Args = - Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) { - WithColor::error(errs(), ProgramName) << Msg << "\n"; - HadParseError = true; - }); - if (HadParseError) - return 1; - bool HadSubcommandError = false; SmallVector OtherPositionals; auto HandleMultipleSubcommands = [&](ArrayRef SubCommands) { @@ -3659,33 +3646,17 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { OtherPositionals.append(Positionals.begin(), Positionals.end()); }; - auto IsKnownSubcommand = [&](StringRef Name) { - return llvm::any_of( - Tbl.getSubCommands(), - [&](const opt::OptTable::SubCommand &SC) { return Name == SC.Name; }); - }; - - StringRef RawFirstArg = argc > 1 ? StringRef(argv[1]) : StringRef(); - StringRef RawSubcommand = - IsKnownSubcommand(RawFirstArg) ? RawFirstArg : StringRef(); + unsigned MissingArgIndex = 0; + unsigned MissingArgCount = 0; + ArrayRef ArgsArr = ArrayRef(argv + 1, argc - 1); + opt::InputArgList Args = + Tbl.ParseArgs(ArgsArr, MissingArgIndex, MissingArgCount); StringRef Subcommand = Args.getSubCommand( Tbl.getSubCommands(), HandleMultipleSubcommands, HandleOtherPositionals); if (HadSubcommandError) return 1; - if (Subcommand.empty() && !OtherPositionals.empty() && - IsKnownSubcommand(OtherPositionals.front())) { - Subcommand = OtherPositionals.front(); - OtherPositionals.erase(OtherPositionals.begin()); - } - if (Subcommand.empty() && !RawSubcommand.empty()) { - Subcommand = RawSubcommand; - auto It = llvm::find(OtherPositionals, Subcommand); - if (It != OtherPositionals.end()) - OtherPositionals.erase(It); - } - if (Args.hasArg(OPT_help)) { std::string Usage = ProgramName + " [subcommand] [options]"; Tbl.printHelp(outs(), Usage.c_str(), "LLVM profile data", @@ -3694,6 +3665,26 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { return 0; } + bool HadParseError = false; + if (MissingArgCount) { + WithColor::error(errs(), ProgramName) + << Args.getArgString(MissingArgIndex) << ": missing argument\n"; + HadParseError = true; + } + + bool HasUnknownOptions = false; + for (const opt::Arg *A : Args.filtered(OPT_UNKNOWN)) { + HasUnknownOptions = true; + errs() << ProgramName << ": Unknown option `" << A->getAsString(Args) + << "'\n"; + } + if (HasUnknownOptions) { + errs() << "See `" << ProgramName << " --help`.\n"; + HadParseError = true; + } + if (HadParseError) + return 1; + if (Args.hasArg(OPT_version)) { outs() << ProgramName << '\n'; cl::PrintVersionMessage(); From 91b91724a1435a4e601aac4201d7376389330ccf Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sun, 15 Feb 2026 09:19:02 -0500 Subject: [PATCH 5/6] more fixes --- .../tools/llvm-profdata/multiple-inputs.test | 2 +- llvm/tools/llvm-profdata/CMakeLists.txt | 5 +-- llvm/tools/llvm-profdata/Opts.td | 7 ++- llvm/tools/llvm-profdata/llvm-profdata.cpp | 43 ++++++++----------- .../llvm-project-overlay/llvm/BUILD.bazel | 13 +----- .../llvm-project-overlay/llvm/driver.bzl | 1 - 6 files changed, 23 insertions(+), 48 deletions(-) diff --git a/llvm/test/tools/llvm-profdata/multiple-inputs.test b/llvm/test/tools/llvm-profdata/multiple-inputs.test index 522d8876ac7ff..d2d93a6459e7e 100644 --- a/llvm/test/tools/llvm-profdata/multiple-inputs.test +++ b/llvm/test/tools/llvm-profdata/multiple-inputs.test @@ -54,7 +54,7 @@ DISJOINT: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ -RUN: -num-threads 2 -o %t +RUN: --num-threads 2 -o %t RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO4 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ diff --git a/llvm/tools/llvm-profdata/CMakeLists.txt b/llvm/tools/llvm-profdata/CMakeLists.txt index 6d64d48ef5db3..ed7df8528e4a8 100644 --- a/llvm/tools/llvm-profdata/CMakeLists.txt +++ b/llvm/tools/llvm-profdata/CMakeLists.txt @@ -16,9 +16,6 @@ add_llvm_tool(llvm-profdata DEPENDS intrinsics_gen ProfdataOptsTableGen - GENERATE_DRIVER ) -if(NOT LLVM_TOOL_LLVM_DRIVER_BUILD) - target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod) -endif() +target_link_libraries(llvm-profdata PRIVATE LLVMDebuginfod) diff --git a/llvm/tools/llvm-profdata/Opts.td b/llvm/tools/llvm-profdata/Opts.td index e147b60a9b062..038200f910e61 100644 --- a/llvm/tools/llvm-profdata/Opts.td +++ b/llvm/tools/llvm-profdata/Opts.td @@ -360,8 +360,7 @@ def num_test_traces MetaVarName<"">; def fs_discriminator_pass - : JoinedOrSeparate<["--"], "fs-discriminator-pass", - [Show, Overlap, Merge]>, + : Joined<["--"], "fs-discriminator-pass=", [Show, Overlap, Merge]>, + Values<"base,pass1,pass2,pass3,passlast">, HelpText<"Zero out the discriminator bits for the FS discriminator " - "pass beyond this value.">, - MetaVarName<"">; + "pass beyond this value.">; diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 4d6a936773897..ffeaf422b8204 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -10,10 +10,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/SmallSet.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" @@ -42,6 +40,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/LLVMDriver.h" #include "llvm/Support/MD5.h" #include "llvm/Support/MemoryBuffer.h" @@ -682,8 +681,6 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs, SymbolRemapper *Remapper, int MaxDbgCorrelationWarnings, const StringRef ProfiledBinary) { - const uint64_t TraceReservoirSize = TemporalProfTraceReservoirSize; - const uint64_t MaxTraceLength = TemporalProfMaxTraceLength; if (OutputFormat == PF_Compact_Binary) exitWithError("Compact Binary is deprecated"); if (OutputFormat != PF_Binary && OutputFormat != PF_Ext_Binary && @@ -751,8 +748,8 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs, SmallVector, 4> Contexts; for (unsigned I = 0; I < NumThreads; ++I) Contexts.emplace_back(std::make_unique( - OutputSparse, ErrorLock, WriterErrorCodes, TraceReservoirSize, - MaxTraceLength)); + OutputSparse, ErrorLock, WriterErrorCodes, + TemporalProfTraceReservoirSize, TemporalProfMaxTraceLength)); if (NumThreads == 1) { for (const auto &Input : Inputs) @@ -3121,8 +3118,8 @@ static int order_main() { ArrayRef Traces = Reader->getTemporalProfTraces(); if (NumTestTraces && NumTestTraces >= Traces.size()) exitWithError( - "--num-test-traces" - " must be smaller than the total number of traces: expected: < " + + "--num-test-traces must be smaller than the total number of traces: " + "expected: < " + Twine(Traces.size()) + ", actual: " + Twine(NumTestTraces)); ArrayRef TestTraces = Traces.take_back(NumTestTraces); Traces = Traces.drop_back(NumTestTraces); @@ -3295,23 +3292,17 @@ static bool parseFSDiscriminatorPassArg(const opt::InputArgList &Args) { if (!A) return true; - StringRef Value = A->getValue(); + std::string Value = StringRef(A->getValue()).lower(); auto Parsed = StringSwitch>(Value) - .Case("Base", FSDiscriminatorPass::Base) .Case("base", FSDiscriminatorPass::Base) - .Case("Pass1", FSDiscriminatorPass::Pass1) .Case("pass1", FSDiscriminatorPass::Pass1) - .Case("Pass2", FSDiscriminatorPass::Pass2) .Case("pass2", FSDiscriminatorPass::Pass2) - .Case("Pass3", FSDiscriminatorPass::Pass3) .Case("pass3", FSDiscriminatorPass::Pass3) - .Case("PassLast", FSDiscriminatorPass::PassLast) - .Case("pass-last", FSDiscriminatorPass::PassLast) .Case("passlast", FSDiscriminatorPass::PassLast) .Default(std::nullopt); if (!Parsed) { - reportCmdLineError(Twine("invalid argument '") + Value + "' for option '" + - A->getSpelling() + "'"); + reportCmdLineError(Twine("invalid argument '") + A->getValue() + + "' for option '" + A->getSpelling() + "'"); return false; } FSDiscriminatorPassOption = *Parsed; @@ -3325,9 +3316,6 @@ static bool validateSubcommandOptions(const opt::InputArgList &Args, if (A->getOption().matches(OPT_UNKNOWN) || A->getOption().matches(OPT_INPUT)) continue; - // Options without an explicit subcommand are available everywhere. - if (A->getOption().matches(OPT_help) || A->getOption().matches(OPT_version)) - continue; if (A->getOption().isRegisteredSC(Subcommand)) continue; reportCmdLineError(Twine("unknown command line argument '") + @@ -3697,28 +3685,26 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { return 1; } - ArrayRef Positionals = OtherPositionals; - if (!validateSubcommandOptions(Args, Subcommand)) return 1; if (Subcommand == "merge") { - if (!parseMergeOptions(Args, Positionals)) + if (!parseMergeOptions(Args, OtherPositionals)) return 1; return merge_main(ProgramName); } if (Subcommand == "show") { - if (!parseShowOptions(Args, Positionals)) + if (!parseShowOptions(Args, OtherPositionals)) return 1; return show_main(ProgramName); } if (Subcommand == "overlap") { - if (!parseOverlapOptions(Args, Positionals)) + if (!parseOverlapOptions(Args, OtherPositionals)) return 1; return overlap_main(); } if (Subcommand == "order") { - if (!parseOrderOptions(Args, Positionals)) + if (!parseOrderOptions(Args, OtherPositionals)) return 1; return order_main(); } @@ -3727,3 +3713,8 @@ int llvm_profdata_main(int argc, char **argv, const llvm::ToolContext &) { << " --help for usage.\n"; return 1; } + +int main(int argc, char **argv) { + InitLLVM X(argc, argv); + return llvm_profdata_main(argc, argv, {argv[0], nullptr, false}); +} diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel index dc217486f396e..97ec5c8bca39e 100644 --- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel @@ -5870,23 +5870,12 @@ cc_library( ":Core", ":Debuginfod", ":Object", - ":Option", - ":ProfdataOptsTableGen", ":ProfileData", ":Support", ], ) -gentbl_cc_library( - name = "ProfdataOptsTableGen", - strip_include_prefix = "tools/llvm-profdata", - tbl_outs = {"tools/llvm-profdata/Opts.inc": ["-gen-opt-parser-defs"]}, - tblgen = ":llvm-tblgen", - td_file = "tools/llvm-profdata/Opts.td", - deps = [":OptParserTdFiles"], -) - -llvm_driver_cc_binary( +cc_binary( name = "llvm-profdata", stamp = 0, deps = [":llvm-profdata-lib"], diff --git a/utils/bazel/llvm-project-overlay/llvm/driver.bzl b/utils/bazel/llvm-project-overlay/llvm/driver.bzl index 331e3f7e0db1f..e38c681370ed1 100644 --- a/utils/bazel/llvm-project-overlay/llvm/driver.bzl +++ b/utils/bazel/llvm-project-overlay/llvm/driver.bzl @@ -28,7 +28,6 @@ _TOOLS = { "llvm-nm": "//llvm:llvm-nm-lib", "llvm-objcopy": "//llvm:llvm-objcopy-lib", "llvm-objdump": "//llvm:llvm-objdump-lib", - "llvm-profdata": "//llvm:llvm-profdata-lib", "llvm-rc": "//llvm:llvm-rc-lib", "llvm-readobj": "//llvm:llvm-readobj-lib", "llvm-size": "//llvm:llvm-size-lib", From e75f3ff67608fffd08c8319422b3a593a8c12cf7 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Wed, 4 Mar 2026 12:03:22 -0500 Subject: [PATCH 6/6] fix tests --- bolt/docs/OptimizingClang.md | 2 +- clang/docs/SourceBasedCodeCoverage.rst | 4 +- clang/docs/UsersManual.rst | 10 +-- clang/test/CodeGenCXX/profile-remap.cpp | 4 +- .../optimization-remark-with-hotness-new-pm.c | 2 +- clang/test/Profile/cxx-hash-v2.cpp | 2 +- .../profile/Linux/instrprof-instr-suppl.test | 8 +- .../profile/Linux/instrprof-value-merge-lld.c | 2 +- .../profile/Linux/instrprof-value-merge.c | 6 +- .../test/profile/Posix/instrprof-shared.test | 12 +-- .../Posix/instrprof-value-prof-shared.test | 30 +++---- .../Windows/instrprof-multiprocess.test | 2 +- compiler-rt/test/profile/coverage-inline.cpp | 4 +- compiler-rt/test/profile/infinite_loop.c | 2 +- .../test/profile/instrprof-value-prof-2.c | 2 +- .../profile/instrprof-value-prof-evict.test | 6 +- .../test/profile/instrprof-value-prof-reset.c | 6 +- .../test/profile/instrprof-value-prof.c | 16 ++-- .../test/profile/instrprof-value-prof.test | 10 +-- compiler-rt/test/profile/runtime_infinite.c | 2 +- llvm/docs/CommandGuide/llvm-profdata.rst | 2 +- llvm/test/CodeGen/X86/fsafdo_probe2.ll | 2 +- llvm/test/CodeGen/X86/fsafdo_test2.ll | 4 +- llvm/test/CodeGen/X86/fsafdo_test3.ll | 4 +- llvm/test/Transforms/PGOProfile/memprof.ll | 4 +- .../Transforms/PGOProfile/suppl-profile.ll | 8 +- .../SampleProfile/csspgo-import-list.ll | 4 +- .../SampleProfile/profile-format-compress.ll | 2 +- .../SampleProfile/profile-sample-accurate.ll | 2 +- .../pseudo-probe-stale-profile-toplev-func.ll | 2 +- llvm/test/Transforms/SampleProfile/remap.ll | 2 +- llvm/test/tools/llvm-profdata/compat.proftext | 6 +- .../llvm-profdata/count-mismatch.proftext | 2 +- .../cs-sample-nested-profile.test | 12 +-- .../llvm-profdata/cs-sample-profile.test | 4 +- .../llvm-profdata/cs-sample-trimmer.test | 8 +- .../test/tools/llvm-profdata/csprof-dump.test | 14 +-- llvm/test/tools/llvm-profdata/cutoff.test | 12 +-- .../llvm-profdata/forward-compatible.test | 8 +- .../test/tools/llvm-profdata/general.proftext | 2 +- .../llvm-profdata/hash-mismatch.proftext | 2 +- llvm/test/tools/llvm-profdata/help.test | 8 +- llvm/test/tools/llvm-profdata/input-dir.test | 4 +- .../tools/llvm-profdata/input-filenames.test | 4 +- .../tools/llvm-profdata/input-wildcard.test | 2 +- .../test/tools/llvm-profdata/instr-remap.test | 2 +- .../tools/llvm-profdata/invalid-profdata.test | 4 +- .../malformed-num-counters-zero.test | 10 +-- .../test/tools/llvm-profdata/mcdc-bitmap.test | 8 +- .../llvm-profdata/memop-size-prof.proftext | 10 +-- .../tools/llvm-profdata/merge-filter.test | 6 +- .../llvm-profdata/merge-probe-profile.test | 4 +- .../llvm-profdata/merge_empty_profile.test | 8 +- .../tools/llvm-profdata/multiple-inputs.test | 28 +++--- .../tools/llvm-profdata/overflow-instr.test | 8 +- .../tools/llvm-profdata/overflow-sample.test | 8 +- llvm/test/tools/llvm-profdata/overlap.test | 4 +- llvm/test/tools/llvm-profdata/overlap_cs.test | 4 +- .../profile-symbol-list-compress.test | 16 ++-- .../llvm-profdata/profile-symbol-list.test | 20 ++--- .../tools/llvm-profdata/pseudo_count.test | 24 +++--- .../tools/llvm-profdata/raw-32-bits-be.test | 4 +- .../tools/llvm-profdata/raw-32-bits-le.test | 4 +- .../tools/llvm-profdata/raw-64-bits-be.test | 4 +- .../tools/llvm-profdata/raw-64-bits-le.test | 4 +- .../tools/llvm-profdata/raw-two-profiles.test | 2 +- .../tools/llvm-profdata/read-traces.proftext | 8 +- .../llvm-profdata/roundtrip-compress.test | 4 +- llvm/test/tools/llvm-profdata/roundtrip.test | 6 +- .../tools/llvm-profdata/same-filename.test | 16 ++-- llvm/test/tools/llvm-profdata/sample-fs.test | 24 +++--- .../llvm-profdata/sample-hot-func-list.test | 2 +- .../tools/llvm-profdata/sample-remap.test | 2 +- .../tools/llvm-profdata/sample-summary.test | 2 +- .../tools/llvm-profdata/show-prof-info.test | 4 +- .../suppl-instr-with-sample-flatten.test | 4 +- .../suppl-instr-with-sample-static-func.test | 16 ++-- .../suppl-instr-with-sample.test | 36 ++++---- llvm/test/tools/llvm-profdata/text-dump.test | 14 +-- .../llvm-profdata/text-format-errors.test | 2 +- .../tools/llvm-profdata/value-prof.proftext | 6 +- .../tools/llvm-profdata/weight-instr.test | 28 +++--- .../tools/llvm-profdata/weight-sample.test | 22 ++--- .../test/tools/llvm-profgen/cs-preinline.test | 8 +- .../tools/llvm-profgen/inline-cs-noprobe.test | 2 +- .../tools/llvm-profgen/inline-noprobe2.test | 2 +- .../llvm-profgen/noinline-cs-noprobe.test | 6 +- llvm/tools/llvm-profdata/Opts.td | 86 +++++++++---------- 88 files changed, 369 insertions(+), 369 deletions(-) diff --git a/bolt/docs/OptimizingClang.md b/bolt/docs/OptimizingClang.md index a5ce9fdcd134d..9992b4c735c22 100644 --- a/bolt/docs/OptimizingClang.md +++ b/bolt/docs/OptimizingClang.md @@ -258,7 +258,7 @@ Once the build is completed, the profile files will be saved under passed back into Clang: ```bash $ cd ${TOPLEV}/stage2-prof-gen/profiles -$ ${TOPLEV}/stage1/install/bin/llvm-profdata merge --output=clang.profdata * +$ ${TOPLEV}/stage1/install/bin/llvm-profdata merge -output=clang.profdata * ``` ### Building Clang with PGO and LTO diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst index 5d4952f67d774..395f2bcc85ef0 100644 --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -156,7 +156,7 @@ coverage reports. This is done using the "merge" tool in ``llvm-profdata`` .. code-block:: console # Step 3(a): Index the raw profile. - % llvm-profdata merge --sparse foo.profraw -o foo.profdata + % llvm-profdata merge -sparse foo.profraw -o foo.profdata For an example of merging multiple profiles created by testing, see the LLVM `coverage build script `_. @@ -261,7 +261,7 @@ A few final notes: .. code-block:: console - % llvm-profdata merge --sparse foo1.profraw foo2.profdata -o foo3.profdata + % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata Exporting coverage data ======================= diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 412de42965ab5..023e9a3c58834 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -3239,7 +3239,7 @@ instrumentation: .. code-block:: console - $ llvm-profdata merge --output=code.profdata code-*.profraw + $ llvm-profdata merge -output=code.profdata code-*.profraw Note that this step is necessary even when there is only one "raw" profile, since the merge operation also changes the file format. @@ -3284,7 +3284,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. .. code-block:: console - $ llvm-profdata merge --output=code.profdata yyy/zzz/ + $ llvm-profdata merge -output=code.profdata yyy/zzz/ If the user wants to turn off the auto-merging feature, or simply override the the profile dumping path specified at command line, the environment variable @@ -3309,7 +3309,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. $ clang++ -O2 -fprofile-generate=yyy/zzz code.cc -o code $ ./code - $ llvm-profdata merge --output=code.profdata yyy/zzz/ + $ llvm-profdata merge -output=code.profdata yyy/zzz/ The first few steps are the same as that in ``-fprofile-generate`` compilation. Then perform a second round of instrumentation. @@ -3319,7 +3319,7 @@ indexed format, regardeless whether it is produced by frontend or the IR pass. $ clang++ -O2 -fprofile-use=code.profdata -fcs-profile-generate=sss/ttt \ -o cs_code $ ./cs_code - $ llvm-profdata merge --output=cs_code.profdata sss/ttt code.profdata + $ llvm-profdata merge -output=cs_code.profdata sss/ttt code.profdata The resulted ``cs_code.prodata`` combines ``code.profdata`` and the profile generated from binary ``cs_code``. Profile ``cs_code.profata`` can be used by @@ -3625,7 +3625,7 @@ instrument functions in a specified group. This can be done using the .. code-block:: console - $ llvm-profdata merge --output=code.profdata group_*/*.profraw + $ llvm-profdata merge -output=code.profdata group_*/*.profraw Profile remapping diff --git a/clang/test/CodeGenCXX/profile-remap.cpp b/clang/test/CodeGenCXX/profile-remap.cpp index 606930e66ea95..748c58d91d105 100644 --- a/clang/test/CodeGenCXX/profile-remap.cpp +++ b/clang/test/CodeGenCXX/profile-remap.cpp @@ -1,9 +1,9 @@ // REQUIRES: x86-registered-target // // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-sample-use=%S/Inputs/profile-remap.samples -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SAMPLES -// RUN: llvm-profdata merge --output %t.profdata %S/Inputs/profile-remap.proftext +// RUN: llvm-profdata merge -output %t.profdata %S/Inputs/profile-remap.proftext // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t.profdata -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-INSTR -// RUN: llvm-profdata merge --output %t.profdata %S/Inputs/profile-remap_entry.proftext +// RUN: llvm-profdata merge -output %t.profdata %S/Inputs/profile-remap_entry.proftext // RUN: %clang_cc1 -triple x86_64-linux-gnu -fprofile-instrument-use=llvm -fprofile-instrument-use-path=%t.profdata -fprofile-remapping-file=%S/Inputs/profile-remap.map -O2 %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-INSTR namespace Foo { diff --git a/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c b/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c index 8d6e1c8b49163..0c7e96182aebf 100644 --- a/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c +++ b/clang/test/Frontend/optimization-remark-with-hotness-new-pm.c @@ -9,7 +9,7 @@ // RUN: llvm-profdata merge \ // RUN: %S/Inputs/optimization-remark-with-hotness.proftext \ // RUN: -o %t.profdata -// RUN: llvm-profdata merge --sample \ +// RUN: llvm-profdata merge -sample \ // RUN: %S/Inputs/optimization-remark-with-hotness-sample.proftext \ // RUN: -o %t-sample.profdata // diff --git a/clang/test/Profile/cxx-hash-v2.cpp b/clang/test/Profile/cxx-hash-v2.cpp index 14a51e890ac57..53097228ba521 100644 --- a/clang/test/Profile/cxx-hash-v2.cpp +++ b/clang/test/Profile/cxx-hash-v2.cpp @@ -1,7 +1,7 @@ // Check that all of the hashes in this file are unique (i.e, that none of the // profiles for these functions are mutually interchangeable). // -// RUN: llvm-profdata show --all-functions %S/Inputs/cxx-hash-v2.profdata.v5 | grep "Hash: 0x" | sort > %t.hashes +// RUN: llvm-profdata show -all-functions %S/Inputs/cxx-hash-v2.profdata.v5 | grep "Hash: 0x" | sort > %t.hashes // RUN: uniq %t.hashes > %t.hashes.unique // RUN: diff %t.hashes %t.hashes.unique diff --git a/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test b/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test index 7f719cfe2111d..54bfd47225422 100644 --- a/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test +++ b/compiler-rt/test/profile/Linux/instrprof-instr-suppl.test @@ -29,15 +29,15 @@ // RUN: llvm-profdata merge main.profraw -o main.profdata // The function counters are not scaled up. -// RUN: llvm-profdata show --all-functions --counts main.profdata | FileCheck %s --check-prefix=INSTR +// RUN: llvm-profdata show -all-functions -counts main.profdata | FileCheck %s --check-prefix=INSTR // The instrPGO profile counter of function foo should be scaled up. Note the // scaling factor of a function is computed based on instrPGO profiles and // invariant to samplePGO profile counters. -// RUN: llvm-profdata merge --supplement-instr-with-sample sampleprof.proftext \ -// RUN: --suppl-min-size-threshold 0 --instr-prof-cold-threshold 1 \ +// RUN: llvm-profdata merge -supplement-instr-with-sample sampleprof.proftext \ +// RUN: -suppl-min-size-threshold 0 -instr-prof-cold-threshold 1 \ // RUN: main.profdata -o merge.profdata -// RUN: llvm-profdata show --all-functions --counts merge.profdata | FileCheck %s --check-prefix=SUPPL +// RUN: llvm-profdata show -all-functions -counts merge.profdata | FileCheck %s --check-prefix=SUPPL // INSTR: Counters: // INSTR: main: diff --git a/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c b/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c index 740bbb8427afd..4559b3fda360e 100644 --- a/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c +++ b/compiler-rt/test/profile/Linux/instrprof-value-merge-lld.c @@ -12,4 +12,4 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show -counts -function main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c diff --git a/compiler-rt/test/profile/Linux/instrprof-value-merge.c b/compiler-rt/test/profile/Linux/instrprof-value-merge.c index afbc4954c60e8..97e0e013f4090 100644 --- a/compiler-rt/test/profile/Linux/instrprof-value-merge.c +++ b/compiler-rt/test/profile/Linux/instrprof-value-merge.c @@ -7,7 +7,7 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show -counts -function main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c /// -z start-stop-gc requires binutils 2.37. Don't test the option for now. /// TODO: Add -Wl,--gc-sections. @@ -18,7 +18,7 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show -counts -function main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c // RUN: %clang_pgogen -o %t -O3 %S/Inputs/instrprof-value-merge.c -no-pie -fuse-ld=gold -ffunction-sections -fdata-sections // RUN: rm -rf %t.profdir @@ -27,4 +27,4 @@ // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 // RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1 -// RUN: llvm-profdata show --counts --function main --ic-targets --memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c +// RUN: llvm-profdata show -counts -function main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %S/Inputs/instrprof-value-merge.c diff --git a/compiler-rt/test/profile/Posix/instrprof-shared.test b/compiler-rt/test/profile/Posix/instrprof-shared.test index 250635fd6be40..7087fa2fa33ed 100644 --- a/compiler-rt/test/profile/Posix/instrprof-shared.test +++ b/compiler-rt/test/profile/Posix/instrprof-shared.test @@ -50,12 +50,12 @@ RUN: not llvm-profdata merge -o %t-no-instr1-no-instr1.profdata %t-no-instr1-no- RUN: not llvm-profdata merge -o %t-no-instr2-no-instr1.profdata %t-no-instr2-no-instr1.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-FILE MISSING-FILE: profraw -RUN: llvm-profdata show --counts --function main %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-main-1 -RUN: llvm-profdata show --counts --function main %t-instr-no-instr1.profdata | grep -v 'Total\|Maximum' > %t-main-2 -RUN: llvm-profdata show --counts --function main %t-instr-no-instr2.profdata | grep -v 'Total\|Maximum' > %t-main-3 -RUN: llvm-profdata show --counts --function foo %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-1 -RUN: llvm-profdata show --counts --function foo %t-no-instr1-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-2 -RUN: llvm-profdata show --counts --function foo %t-no-instr2-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-3 +RUN: llvm-profdata show -counts --function main %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-main-1 +RUN: llvm-profdata show -counts --function main %t-instr-no-instr1.profdata | grep -v 'Total\|Maximum' > %t-main-2 +RUN: llvm-profdata show -counts --function main %t-instr-no-instr2.profdata | grep -v 'Total\|Maximum' > %t-main-3 +RUN: llvm-profdata show -counts --function foo %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-1 +RUN: llvm-profdata show -counts --function foo %t-no-instr1-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-2 +RUN: llvm-profdata show -counts --function foo %t-no-instr2-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-3 RUN: %clang_profuse=%t-instr-instr.profdata -o %t-main-instr-instr.ll -S -emit-llvm %S/../Inputs/instrprof-shared-main.c RUN: %clang_profuse=%t-instr-no-instr1.profdata -o %t-main-instr-no-instr1.ll -S -emit-llvm %S/../Inputs/instrprof-shared-main.c diff --git a/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test b/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test index 844f5a09b3053..34abe82952a23 100644 --- a/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test +++ b/compiler-rt/test/profile/Posix/instrprof-value-prof-shared.test @@ -3,8 +3,8 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t -rpath %t.d %t.d/t.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.shared -DSHARED_LIB %S/../Inputs/instrprof-value-prof-real.c @@ -12,9 +12,9 @@ // Profile data from shared library will be concatenated to the same raw file. // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.profdata -o %t.ir.proftxt -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt // Same as above but with profile online merging enabled. @@ -23,11 +23,11 @@ // RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.m.shared -DSHARED_LIB %S/../Inputs/instrprof-value-prof-real.c // RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.m %t.d/t.ir.m.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.m -// RUN: llvm-profdata merge -o %t.ir.m.profdata --dump-input-file-list %t.prof/ | count 2 +// RUN: llvm-profdata merge -o %t.ir.m.profdata -dump-input-file-list %t.prof/ | count 2 // RUN: llvm-profdata merge -o %t.ir.m.profdata %t.prof/ -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.m.profdata -o %t.ir.m.proftxt -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.m.profdata -o %t.ir.m.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.m.proftxt @@ -36,9 +36,9 @@ // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.dyn %t.d/t.ir.dyn.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt // IR level instrumentation: main program uses static counter, shared library uses dynamic memory alloc. @@ -46,7 +46,7 @@ // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.mixed %t.d/t.ir.dyn.shared -DCALL_SHARED %S/../Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.mixed.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.mixed // RUN: llvm-profdata merge -o %t.ir.mixed.profdata %t.ir.mixed.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.mixed.profdata -o %t.ir.mixed.proftxt -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.mixed.profdata -o %t.ir.mixed.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=SHARED // RUN: FileCheck %S/../Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.mixed.proftxt diff --git a/compiler-rt/test/profile/Windows/instrprof-multiprocess.test b/compiler-rt/test/profile/Windows/instrprof-multiprocess.test index d019dc8b0b902..50a404ba885f3 100644 --- a/compiler-rt/test/profile/Windows/instrprof-multiprocess.test +++ b/compiler-rt/test/profile/Windows/instrprof-multiprocess.test @@ -1,7 +1,7 @@ RUN: %clang_profgen %S/Inputs/instrprof-multiprocess.c -o %t RUN: rm -f %t_*.profraw RUN: env LLVM_PROFILE_FILE=%t_%m.profraw %run %t -RUN: llvm-profdata show --counts --function foo %t_*.profraw | FileCheck %s +RUN: llvm-profdata show --counts -function foo %t_*.profraw | FileCheck %s CHECK: Counters: CHECK: foo: diff --git a/compiler-rt/test/profile/coverage-inline.cpp b/compiler-rt/test/profile/coverage-inline.cpp index c47bca79247a1..a4114363007a3 100644 --- a/compiler-rt/test/profile/coverage-inline.cpp +++ b/compiler-rt/test/profile/coverage-inline.cpp @@ -5,7 +5,7 @@ // RUN: %clang_profgen -g -fcoverage-mapping -c -o %t2.o %s // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe -// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s +// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s // Again, with optimizations and inlining. This tests that we use comdats // correctly. @@ -13,7 +13,7 @@ // RUN: %clang_profgen -O2 -g -fcoverage-mapping -c -o %t2.o %s // RUN: %clang_profgen -g -fcoverage-mapping %t1.o %t2.o -o %t.exe // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.exe -// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s +// RUN: llvm-profdata show %t.profraw -all-functions | FileCheck %s // CHECK: {{.*}}foo{{.*}}: // CHECK-NEXT: Hash: diff --git a/compiler-rt/test/profile/infinite_loop.c b/compiler-rt/test/profile/infinite_loop.c index dd323b46e5d1c..7a0e916977074 100644 --- a/compiler-rt/test/profile/infinite_loop.c +++ b/compiler-rt/test/profile/infinite_loop.c @@ -1,6 +1,6 @@ // RUN: %clang_pgogen -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t -// RUN: llvm-profdata show --function main --counts %t.profraw| FileCheck %s +// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s void exit(int); int g; diff --git a/compiler-rt/test/profile/instrprof-value-prof-2.c b/compiler-rt/test/profile/instrprof-value-prof-2.c index a3646ff77b007..abc990ac8b052 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-2.c +++ b/compiler-rt/test/profile/instrprof-value-prof-2.c @@ -1,7 +1,7 @@ // RUN: %clang_profgen -mllvm -enable-value-profiling -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata > %t.out +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata > %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-1 < %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-2 < %t.out // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-3 < %t.out diff --git a/compiler-rt/test/profile/instrprof-value-prof-evict.test b/compiler-rt/test/profile/instrprof-value-prof-evict.test index bfab4fe53babf..8b054fb24371e 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-evict.test +++ b/compiler-rt/test/profile/instrprof-value-prof-evict.test @@ -1,16 +1,16 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t.ir %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c // IR level instrumentation, dynamic allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -o %t.ir.dyn %S/Inputs/instrprof-value-prof-evict.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c diff --git a/compiler-rt/test/profile/instrprof-value-prof-reset.c b/compiler-rt/test/profile/instrprof-value-prof-reset.c index e8bb0b317c1bc..b3744f5735066 100644 --- a/compiler-rt/test/profile/instrprof-value-prof-reset.c +++ b/compiler-rt/test/profile/instrprof-value-prof-reset.c @@ -1,19 +1,19 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=3 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=3 -o %t.ir %s // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %s // IR level instrumentation, dynamic allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -o %t.ir.dyn %s // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %s void callee_0() {} void callee_1() {} void callee_2() {} diff --git a/compiler-rt/test/profile/instrprof-value-prof.c b/compiler-rt/test/profile/instrprof-value-prof.c index b5a9c254df731..3e8203f8182d1 100644 --- a/compiler-rt/test/profile/instrprof-value-prof.c +++ b/compiler-rt/test/profile/instrprof-value-prof.c @@ -4,9 +4,9 @@ // RUN: llvm-profdata merge -o %t.profdata %t.profraw // RUN: llvm-profdata merge -o %t-2.profdata %t-2.profraw // RUN: llvm-profdata merge -o %t-merged.profdata %t.profraw %t-2.profdata -// RUN: llvm-profdata show --all-functions --ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions --ic-targets %t-merged.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-merged.profdata | FileCheck %s // // RUN: env LLVM_PROFILE_FILE=%t-3.profraw LLVM_VP_BUFFER_SIZE=1 %run %t // RUN: env LLVM_PROFILE_FILE=%t-4.profraw LLVM_VP_BUFFER_SIZE=8 %run %t @@ -18,11 +18,11 @@ // RUN: llvm-profdata merge -o %t-5.profdata %t-5.profraw // RUN: llvm-profdata merge -o %t-6.profdata %t-6.profraw // RUN: llvm-profdata merge -o %t-7.profdata %t-7.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t-3.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions --ic-targets %t-4.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions --ic-targets %t-5.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions --ic-targets %t-6.profdata | FileCheck %s -// RUN: llvm-profdata show --all-functions --ic-targets %t-7.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-3.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-4.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-5.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-6.profdata | FileCheck %s +// RUN: llvm-profdata show --all-functions -ic-targets %t-7.profdata | FileCheck %s #include #include diff --git a/compiler-rt/test/profile/instrprof-value-prof.test b/compiler-rt/test/profile/instrprof-value-prof.test index f0e15ed7d4c63..f85c131e6e4b8 100644 --- a/compiler-rt/test/profile/instrprof-value-prof.test +++ b/compiler-rt/test/profile/instrprof-value-prof.test @@ -2,21 +2,21 @@ // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c // IR level instrumentation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t.ir %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir // RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.profdata -o %t.ir.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt // RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt // IR level instrumentation with dynamic memory allocation // RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -o %t.ir.dyn %S/Inputs/instrprof-value-prof-real.c // RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn // RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw -// RUN: llvm-profdata show --all-functions --ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c -// RUN: llvm-profdata merge --text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt +// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c +// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt // RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt diff --git a/compiler-rt/test/profile/runtime_infinite.c b/compiler-rt/test/profile/runtime_infinite.c index 6058dd5f1475f..b55f5e2750dd9 100644 --- a/compiler-rt/test/profile/runtime_infinite.c +++ b/compiler-rt/test/profile/runtime_infinite.c @@ -6,7 +6,7 @@ // RUN: %clang_pgogen -mllvm -do-counter-promotion=false -O2 -o %t %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t -// RUN: llvm-profdata show --function main --counts %t.profraw| FileCheck %s +// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s void exit(int); int __llvm_profile_dump(void); diff --git a/llvm/docs/CommandGuide/llvm-profdata.rst b/llvm/docs/CommandGuide/llvm-profdata.rst index 8b1dc412444e7..0b1cd02e2230f 100644 --- a/llvm/docs/CommandGuide/llvm-profdata.rst +++ b/llvm/docs/CommandGuide/llvm-profdata.rst @@ -260,7 +260,7 @@ Merge three profiles: :: - llvm-profdata merge foo.profdata bar.profdata baz.profdata --output merged.profdata + llvm-profdata merge foo.profdata bar.profdata baz.profdata -output merged.profdata Weighted Input ++++++++++++++ diff --git a/llvm/test/CodeGen/X86/fsafdo_probe2.ll b/llvm/test/CodeGen/X86/fsafdo_probe2.ll index 618019cf49aff..04e4145abdc0c 100644 --- a/llvm/test/CodeGen/X86/fsafdo_probe2.ll +++ b/llvm/test/CodeGen/X86/fsafdo_probe2.ll @@ -1,5 +1,5 @@ ; REQUIRES: asserts -; RUN: llvm-profdata merge --sample --profile-isfs --extbinary -o %t.afdo %S/Inputs/fsloader-probe.afdo +; RUN: llvm-profdata merge --sample -profile-isfs --extbinary -o %t.afdo %S/Inputs/fsloader-probe.afdo ; RUN: llc -enable-fs-discriminator -fs-profile-file=%t.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefix=LOADER ; ;; diff --git a/llvm/test/CodeGen/X86/fsafdo_test2.ll b/llvm/test/CodeGen/X86/fsafdo_test2.ll index 3a1648d349a86..fc4c1e87dd285 100644 --- a/llvm/test/CodeGen/X86/fsafdo_test2.ll +++ b/llvm/test/CodeGen/X86/fsafdo_test2.ll @@ -1,9 +1,9 @@ ; REQUIRES: asserts ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false < %s | FileCheck %s --check-prefixes=V0,V01 -; RUN: llvm-profdata merge --sample --profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo +; RUN: llvm-profdata merge --sample -profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false -fs-profile-file=%t0.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV0,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true < %s | FileCheck %s --check-prefixes=V1,V01 -; RUN: llvm-profdata merge --sample --profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo +; RUN: llvm-profdata merge --sample -profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%t1.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV1,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%S/Inputs/fsloader_v1.afdo -profile-isfs -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=LOADERV1,LOADER ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%S/Inputs/fsloader_v1.afdo -show-fs-branchprob -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false < %s 2>&1 | FileCheck %s --check-prefixes=NOLOAD diff --git a/llvm/test/CodeGen/X86/fsafdo_test3.ll b/llvm/test/CodeGen/X86/fsafdo_test3.ll index e14f2d0761e86..79b57fe4f1a32 100644 --- a/llvm/test/CodeGen/X86/fsafdo_test3.ll +++ b/llvm/test/CodeGen/X86/fsafdo_test3.ll @@ -1,6 +1,6 @@ -; RUN: llvm-profdata merge --sample --profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo +; RUN: llvm-profdata merge --sample -profile-isfs -o %t0.afdo %S/Inputs/fsloader.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=false -fs-profile-file=%t0.afdo -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false -print-machine-bfi -print-bfi-func-name=foo -print-before=fs-profile-loader -stop-after=fs-profile-loader < %s 2>&1 | FileCheck %s --check-prefixes=BFI,BFIV0 -; RUN: llvm-profdata merge --sample --profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo +; RUN: llvm-profdata merge --sample -profile-isfs -o %t1.afdo %S/Inputs/fsloader_v1.afdo ; RUN: llc -enable-fs-discriminator -improved-fs-discriminator=true -fs-profile-file=%t1.afdo -disable-ra-fsprofile-loader=false -disable-layout-fsprofile-loader=false -print-machine-bfi -print-bfi-func-name=foo -print-before=fs-profile-loader -stop-after=fs-profile-loader < %s 2>&1 | FileCheck %s --check-prefixes=BFI,BFIV1 ; ;; diff --git a/llvm/test/Transforms/PGOProfile/memprof.ll b/llvm/test/Transforms/PGOProfile/memprof.ll index 63fa2ec5907f9..531bc9d8631cb 100644 --- a/llvm/test/Transforms/PGOProfile/memprof.ll +++ b/llvm/test/Transforms/PGOProfile/memprof.ll @@ -91,14 +91,14 @@ ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -memprof-cloning-cold-threshold=80 -memprof-keep-all-not-cold-contexts 2>&1 | FileCheck %s --check-prefixes=TOTALSIZES,TOTALSIZESKEEPALL ;; Make sure we emit a random hotness seed if requested. -; RUN: llvm-profdata merge --memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND +; RUN: llvm-profdata merge -memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND ; RAND: random hotness seed = ;; Can't check the exact values, but make sure applying the random profile ;; succeeds with the same stats ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=ALL,MEMPROFONLY,MEMPROFSTATS ;; Make sure we use a specific random hotness seed if requested. -; RUN: llvm-profdata merge --memprof-random-hotness --memprof-random-hotness-seed 1730170724 %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand2 2>&1 | FileCheck %s --check-prefix=RAND2 +; RUN: llvm-profdata merge -memprof-random-hotness -memprof-random-hotness-seed 1730170724 %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand2 2>&1 | FileCheck %s --check-prefix=RAND2 ; RAND2: random hotness seed = 1730170724 ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=MEMPROFRAND2,ALL,MEMPROFONLY,MEMPROFSTATS diff --git a/llvm/test/Transforms/PGOProfile/suppl-profile.ll b/llvm/test/Transforms/PGOProfile/suppl-profile.ll index 175b565ef06e3..1cabd069289b8 100644 --- a/llvm/test/Transforms/PGOProfile/suppl-profile.ll +++ b/llvm/test/Transforms/PGOProfile/suppl-profile.ll @@ -1,13 +1,13 @@ ; Supplement instr profile suppl-profile.proftext with sample profile ; sample-profile.proftext. ; For hot functions: -; RUN: llvm-profdata merge --instr --suppl-min-size-threshold 0 \ -; RUN: --supplement-instr-with-sample %p/Inputs/sample-profile-hot.proftext \ +; RUN: llvm-profdata merge -instr -suppl-min-size-threshold 0 \ +; RUN: -supplement-instr-with-sample %p/Inputs/sample-profile-hot.proftext \ ; RUN: %S/Inputs/suppl-profile.proftext -o %t.profdata ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=HOT ; For warm functions: -; RUN: llvm-profdata merge --instr --suppl-min-size-threshold 0 \ -; RUN: --supplement-instr-with-sample %p/Inputs/sample-profile-warm.proftext \ +; RUN: llvm-profdata merge -instr -suppl-min-size-threshold 0 \ +; RUN: -supplement-instr-with-sample %p/Inputs/sample-profile-warm.proftext \ ; RUN: %S/Inputs/suppl-profile.proftext -o %t1.profdata ; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t1.profdata -S | FileCheck %s --check-prefix=WARM diff --git a/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll b/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll index 35a529856f20e..ade2d73fb4684 100644 --- a/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll +++ b/llvm/test/Transforms/SampleProfile/csspgo-import-list.ll @@ -2,10 +2,10 @@ ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%S/Inputs/csspgo-import-list.prof --sample-profile-even-flow-distribution=0 -S | FileCheck %s ; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/csspgo-import-list.prof -o %t.prof ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.prof --sample-profile-even-flow-distribution=0 -S | FileCheck %s -; RUN: llvm-profdata show --sample --show-sec-info-only %t.prof | FileCheck %s --check-prefix=CHECK-ORDERED +; RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s --check-prefix=CHECK-ORDERED ; RUN: llvm-profdata merge --sample --extbinary --use-md5 %S/Inputs/csspgo-import-list.prof -o %t.md5 ; RUN: opt < %s -passes='thinlto-pre-link' -pgo-kind=pgo-sample-use-pipeline -sample-profile-file=%t.md5 --sample-profile-even-flow-distribution=0 -S | FileCheck %s -; RUN: llvm-profdata show --sample --show-sec-info-only %t.md5 | FileCheck %s --check-prefix=CHECK-ORDERED +; RUN: llvm-profdata show --sample -show-sec-info-only %t.md5 | FileCheck %s --check-prefix=CHECK-ORDERED ;; Validate that with replay in effect, we import call sites even if they are below the threshold ;; Baseline import decisions diff --git a/llvm/test/Transforms/SampleProfile/profile-format-compress.ll b/llvm/test/Transforms/SampleProfile/profile-format-compress.ll index 28f9280123259..112da585d90b3 100644 --- a/llvm/test/Transforms/SampleProfile/profile-format-compress.ll +++ b/llvm/test/Transforms/SampleProfile/profile-format-compress.ll @@ -1,6 +1,6 @@ ; REQUIRES: zlib ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof -S | FileCheck %s -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections %S/Inputs/inline.prof -o %t.compress.extbinary.afdo +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections %S/Inputs/inline.prof -o %t.compress.extbinary.afdo ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.compress.extbinary.afdo -S | FileCheck %s ; Original C++ test case diff --git a/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll b/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll index 2cf113a61dae3..a1b0747b2ff51 100644 --- a/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll +++ b/llvm/test/Transforms/SampleProfile/profile-sample-accurate.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/profsampleacc.extbinary.afdo -profile-summary-cutoff-hot=900000 -profile-sample-accurate -S | FileCheck %s --check-prefix=CALL_SUM_IS_HOT -; RUN: llvm-profdata merge --sample --extbinary --prof-sym-list %S/Inputs/profile-symbol-list.text %S/Inputs/profsampleacc.extbinary.afdo -o %t.symlist.afdo +; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list %S/Inputs/profile-symbol-list.text %S/Inputs/profsampleacc.extbinary.afdo -o %t.symlist.afdo ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-summary-cutoff-hot=600000 -profile-accurate-for-symsinlist -S | FileCheck %s --check-prefix=PROFSYMLIST ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-accurate-for-symsinlist -profile-symbol-list-cutoff=2 -S | FileCheck %s --check-prefix=PSLCUTOFF2 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.symlist.afdo -profile-accurate-for-symsinlist -profile-symbol-list-cutoff=3 -S | FileCheck %s --check-prefix=PSLCUTOFF3 diff --git a/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll b/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll index 1c6d8501d317a..8c041314a583c 100644 --- a/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll +++ b/llvm/test/Transforms/SampleProfile/pseudo-probe-stale-profile-toplev-func.ll @@ -1,6 +1,6 @@ ; REQUIRES: asserts && x86-registered-target ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/pseudo-probe-stale-profile-toplev-func.prof --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching 2>&1 | FileCheck %s -check-prefix=CHECK-TEXT -; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/pseudo-probe-stale-profile-toplev-func.prof -o %t.extbinary +; RUN: llvm-profdata merge --sample -extbinary %S/Inputs/pseudo-probe-stale-profile-toplev-func.prof -o %t.extbinary ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%t.extbinary --salvage-stale-profile --salvage-unused-profile -report-profile-staleness -S --debug-only=sample-profile,sample-profile-matcher,sample-profile-impl -pass-remarks=inline --min-call-count-for-cg-matching=0 --min-func-count-for-cg-matching=0 --load-func-profile-for-cg-matching 2>&1 | FileCheck %s -check-prefix=CHECK-EXTBIN ; CHECK-TEXT: Run stale profile matching for main diff --git a/llvm/test/Transforms/SampleProfile/remap.ll b/llvm/test/Transforms/SampleProfile/remap.ll index c883e6c517e81..ffb57e23a735c 100644 --- a/llvm/test/Transforms/SampleProfile/remap.ll +++ b/llvm/test/Transforms/SampleProfile/remap.ll @@ -1,7 +1,7 @@ ; RUN: opt %s -passes=sample-profile -sample-profile-file=%S/Inputs/remap.prof -sample-profile-remapping-file=%S/Inputs/remap.map | opt -passes='print' -disable-output 2>&1 | FileCheck %s ; ; Check whether profile remapping work with loading profile on demand used by extbinary format profile. -; RUN: llvm-profdata merge --sample --extbinary %S/Inputs/remap.prof -o %t.extbinary.afdo +; RUN: llvm-profdata merge -sample -extbinary %S/Inputs/remap.prof -o %t.extbinary.afdo ; RUN: opt %s -passes=sample-profile -sample-profile-file=%t.extbinary.afdo -sample-profile-remapping-file=%S/Inputs/remap.map | opt -passes='print' -disable-output 2>&1 | FileCheck %s ; ; Reduced from branch.ll diff --git a/llvm/test/tools/llvm-profdata/compat.proftext b/llvm/test/tools/llvm-profdata/compat.proftext index 0879a33150f22..111fd41988197 100644 --- a/llvm/test/tools/llvm-profdata/compat.proftext +++ b/llvm/test/tools/llvm-profdata/compat.proftext @@ -46,7 +46,7 @@ large_numbers # SUMMARY: Maximum function count: 2305843009213693952 # SUMMARY: Maximum internal block count: 1152921504606846976 -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v2 --all-functions --counts | FileCheck %s -check-prefix=FORMATV2 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v2 -all-functions --counts | FileCheck %s -check-prefix=FORMATV2 # FORMATV2: Counters: # FORMATV2-NEXT: foo: @@ -65,7 +65,7 @@ large_numbers # FORMATV2-NEXT: Maximum function count: 499500 # FORMATV2-NEXT: Maximum internal block count: 1000000 # -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 --all-functions --counts | FileCheck %s -check-prefix=FORMATV4 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 -all-functions --counts | FileCheck %s -check-prefix=FORMATV4 # FORMATV4: Counters: # FORMATV4: name with spaces: @@ -88,7 +88,7 @@ large_numbers # FORMATV4: Maximum function count: 2305843009213693952 # FORMATV4: Maximum internal block count: 1152921504606846976 -# RUN: llvm-profdata show %S/Inputs/compat.profdata.v10 --all-functions --counts | FileCheck %s -check-prefix=FORMATV10 +# RUN: llvm-profdata show %S/Inputs/compat.profdata.v10 -all-functions --counts | FileCheck %s -check-prefix=FORMATV10 # FORMATV10: Counters: # FORMATV10: large_numbers: diff --git a/llvm/test/tools/llvm-profdata/count-mismatch.proftext b/llvm/test/tools/llvm-profdata/count-mismatch.proftext index 13bb29225b2e1..c4ac2f7866d19 100644 --- a/llvm/test/tools/llvm-profdata/count-mismatch.proftext +++ b/llvm/test/tools/llvm-profdata/count-mismatch.proftext @@ -2,7 +2,7 @@ # name and a matching hash if the number of counters differs # RUN: llvm-profdata merge %s -o %t.profdata 2>&1 | FileCheck -check-prefix=MERGE_ERRS %s -# RUN: llvm-profdata show %t.profdata --all-functions --counts > %t.out +# RUN: llvm-profdata show %t.profdata -all-functions -counts > %t.out # RUN: FileCheck %s -input-file %t.out foo 1024 diff --git a/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test b/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test index 12855cf17d06e..38b770a65840f 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-nested-profile.test @@ -5,13 +5,13 @@ RUN: FileCheck %s < %t.probe.proftext --match-full-lines --strict-whitespace -ch RUN: llvm-profdata merge --sample --extbinary -o %t.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest RUN: llvm-profdata merge --sample --text -o %t2.proftext %t.profbin RUN: FileCheck %s < %t2.proftext --match-full-lines --strict-whitespace -RUN: llvm-profdata show --sample --show-sec-info-only %t.profbin | FileCheck %s -check-prefix=PREINLINE -RUN: llvm-profdata merge --sample --text -o %t3.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest --generate-merged-base-profiles +RUN: llvm-profdata show --sample -show-sec-info-only %t.profbin | FileCheck %s -check-prefix=PREINLINE +RUN: llvm-profdata merge --sample --text -o %t3.proftext %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest -generate-merged-base-profiles RUN: FileCheck %s < %t3.proftext --match-full-lines --strict-whitespace -check-prefix=RECOUNT -RUN: llvm-profdata merge --sample --extbinary -o %t2.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest --generate-merged-base-profiles -RUN: llvm-profdata show --sample --detailed-summary %S/Inputs/cs-sample-preinline.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show --sample --detailed-summary %t2.profbin | FileCheck %s -check-prefix=SUMMARY-NEST -RUN: llvm-profdata show --sample --detailed-summary %t3.proftext | FileCheck %s -check-prefix=SUMMARY-NEST +RUN: llvm-profdata merge --sample --extbinary -o %t2.profbin %S/Inputs/cs-sample-preinline.proftext --convert-sample-profile-layout nest -generate-merged-base-profiles +RUN: llvm-profdata show -sample -detailed-summary %S/Inputs/cs-sample-preinline.proftext | FileCheck %s -check-prefix=SUMMARY +RUN: llvm-profdata show -sample -detailed-summary %t2.profbin | FileCheck %s -check-prefix=SUMMARY-NEST +RUN: llvm-profdata show -sample -detailed-summary %t3.proftext | FileCheck %s -check-prefix=SUMMARY-NEST ; CHECK:main:1968621:12 diff --git a/llvm/test/tools/llvm-profdata/cs-sample-profile.test b/llvm/test/tools/llvm-profdata/cs-sample-profile.test index 9d90807664492..a5fe0e9955e1b 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-profile.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-profile.test @@ -1,6 +1,6 @@ -RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext +RUN: llvm-profdata merge -sample --text -o %t.proftext %S/Inputs/cs-sample.proftext RUN: diff -b %t.proftext %S/Inputs/cs-sample.proftext RUN: llvm-profdata merge --sample --extbinary %p/Inputs/cs-sample.proftext -o %t.prof && llvm-profdata merge --sample --text %t.prof -o %t1.proftext RUN: diff -b %t1.proftext %S/Inputs/cs-sample.proftext -RUN: llvm-profdata show --sample --show-sec-info-only %t.prof | FileCheck %s +RUN: llvm-profdata show --sample -show-sec-info-only %t.prof | FileCheck %s CHECK: FunctionMetadata {{.*}} Flags: {attr} diff --git a/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test b/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test index 0b8cc30b4b809..1d8d7e3a2be1c 100644 --- a/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test +++ b/llvm/test/tools/llvm-profdata/cs-sample-trimmer.test @@ -1,11 +1,11 @@ -RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext +RUN: llvm-profdata merge -sample --text -o %t.proftext %S/Inputs/cs-sample.proftext RUN: diff -b %t.proftext %S/Inputs/cs-sample.proftext -RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --profile-summary-cold-count 500 +RUN: llvm-profdata merge -sample --text -o %t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -profile-summary-cold-count 500 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-MERGE -RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --sample-trim-cold-context --profile-summary-cold-count 500 +RUN: llvm-profdata merge -sample --text -o %t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -sample-trim-cold-context -profile-summary-cold-count 500 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-END -RUN: llvm-profdata merge --sample --text -o %t.proftext %S/Inputs/cs-sample.proftext --sample-merge-cold-context --sample-trim-cold-context --profile-summary-cutoff-cold 990000 +RUN: llvm-profdata merge -sample --text -o %t.proftext %S/Inputs/cs-sample.proftext -sample-merge-cold-context -sample-trim-cold-context -profile-summary-cutoff-cold 990000 RUN: FileCheck %s --input-file %t.proftext --check-prefixes=CHECK-TRIM,CHECK-END CHECK-TRIM: [main:3 @ _Z5funcAi:1 @ _Z8funcLeafi]:1467299:11 diff --git a/llvm/test/tools/llvm-profdata/csprof-dump.test b/llvm/test/tools/llvm-profdata/csprof-dump.test index ae3154102b255..a03b9d8a003e1 100644 --- a/llvm/test/tools/llvm-profdata/csprof-dump.test +++ b/llvm/test/tools/llvm-profdata/csprof-dump.test @@ -1,8 +1,8 @@ Basic test for option -showcs: RUN: llvm-profdata show %p/Inputs/cs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY RUN: llvm-profdata show %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show --showcs %p/Inputs/cs.proftext | FileCheck %s -check-prefix=SUMMARY -RUN: llvm-profdata show --showcs %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY +RUN: llvm-profdata show -showcs %p/Inputs/cs.proftext | FileCheck %s -check-prefix=SUMMARY +RUN: llvm-profdata show -showcs %p/Inputs/noncs.proftext | FileCheck %s -check-prefix=ZEROSUMMARY ZEROSUMMARY: Instrumentation level: IR ZEROSUMMARY: Total functions: 0 ZEROSUMMARY: Maximum function count: 0 @@ -15,17 +15,17 @@ SUMMARY: Maximum internal block count: 62 Basic tests for context sensitive profile dump functions: RUN: llvm-profdata merge -o %t-combined.profdata %p/Inputs/cs.proftext %p/Inputs/noncs.proftext -RUN: llvm-profdata show --all-functions --counts --showcs %p/Inputs/cs.proftext > %t-text.csdump -RUN: llvm-profdata show --all-functions --counts --showcs %t-combined.profdata > %t-index.csdump +RUN: llvm-profdata show --all-functions -counts -showcs %p/Inputs/cs.proftext > %t-text.csdump +RUN: llvm-profdata show --all-functions -counts -showcs %t-combined.profdata > %t-index.csdump RUN: diff %t-text.csdump %t-index.csdump -RUN: llvm-profdata show --all-functions --counts %p/Inputs/noncs.proftext > %t-text.noncsdump -RUN: llvm-profdata show --all-functions --counts %t-combined.profdata > %t-index.noncsdump +RUN: llvm-profdata show --all-functions -counts %p/Inputs/noncs.proftext > %t-text.noncsdump +RUN: llvm-profdata show --all-functions -counts %t-combined.profdata > %t-index.noncsdump RUN: diff %t-text.noncsdump %t-index.noncsdump Roundtrip test: RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/CSIR_profile.proftext -RUN: llvm-profdata merge --text -o %t.0.proftext %t.0.profdata +RUN: llvm-profdata merge -text -o %t.0.proftext %t.0.profdata RUN: diff -b %t.0.proftext %S/Inputs/CSIR_profile.proftext diff --git a/llvm/test/tools/llvm-profdata/cutoff.test b/llvm/test/tools/llvm-profdata/cutoff.test index 57114115aee46..2595371bc04ff 100644 --- a/llvm/test/tools/llvm-profdata/cutoff.test +++ b/llvm/test/tools/llvm-profdata/cutoff.test @@ -1,11 +1,11 @@ Basic tests for cutoff options in show command. -RUN: llvm-profdata show --value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1,CHECK -RUN: llvm-profdata show --value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000,CHECK -RUN: llvm-profdata show --all-functions --value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1FUNC,CUTOFF1,CHECK -RUN: llvm-profdata show --all-functions --value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000FUNC,CUTOFF1000,CHECK -RUN: llvm-profdata show --value-cutoff 1 --list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1,CUTOFF1,CHECK -RUN: llvm-profdata show --value-cutoff 1000 --list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1000,CUTOFF1000,CHECK +RUN: llvm-profdata show -value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1,CHECK +RUN: llvm-profdata show -value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000,CHECK +RUN: llvm-profdata show -all-functions -value-cutoff 1 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1FUNC,CUTOFF1,CHECK +RUN: llvm-profdata show -all-functions -value-cutoff 1000 %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=CUTOFF1000FUNC,CUTOFF1000,CHECK +RUN: llvm-profdata show -value-cutoff 1 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1,CUTOFF1,CHECK +RUN: llvm-profdata show -value-cutoff 1000 -list-below-cutoff %p/Inputs/cutoff.proftext | FileCheck %s -check-prefixes=BELOW1000,CUTOFF1000,CHECK CUTOFF1FUNC-NOT: bar CUTOFF1FUNC: Functions shown: 2 CUTOFF1000FUNC-NOT: bar diff --git a/llvm/test/tools/llvm-profdata/forward-compatible.test b/llvm/test/tools/llvm-profdata/forward-compatible.test index a5b0883617e59..51a7336bb4056 100644 --- a/llvm/test/tools/llvm-profdata/forward-compatible.test +++ b/llvm/test/tools/llvm-profdata/forward-compatible.test @@ -1,8 +1,8 @@ REQUIRES: zlib -RUN: llvm-profdata show --sample %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -RUN: llvm-profdata show --sample %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -RUN: llvm-profdata show --sample --show-sec-info-only %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -check-prefix=HDR -RUN: llvm-profdata show --sample --show-sec-info-only %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -check-prefix=HDR-COMPRESS +RUN: llvm-profdata show -sample %S/Inputs/unknown.section.extbin.profdata | FileCheck %s +RUN: llvm-profdata show -sample %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s +RUN: llvm-profdata show -sample -show-sec-info-only %S/Inputs/unknown.section.extbin.profdata | FileCheck %s -check-prefix=HDR +RUN: llvm-profdata show -sample -show-sec-info-only %S/Inputs/unknown.section.compressed.extbin.profdata | FileCheck %s -check-prefix=HDR-COMPRESS # The input unknown.section.extbin.profdata contains an unknown section type # which uses an enum value which won't be used in the near future. Check diff --git a/llvm/test/tools/llvm-profdata/general.proftext b/llvm/test/tools/llvm-profdata/general.proftext index 72ba3c49ddf67..7fe3b988c3db7 100644 --- a/llvm/test/tools/llvm-profdata/general.proftext +++ b/llvm/test/tools/llvm-profdata/general.proftext @@ -1,4 +1,4 @@ -# RUN: llvm-profdata merge --sparse %s -o %t.profdata +# RUN: llvm-profdata merge -sparse %s -o %t.profdata # RUN: llvm-profdata merge %s -o %t.profdata.dense diff --git a/llvm/test/tools/llvm-profdata/hash-mismatch.proftext b/llvm/test/tools/llvm-profdata/hash-mismatch.proftext index 15abd7f7760f1..24908e288d6b4 100644 --- a/llvm/test/tools/llvm-profdata/hash-mismatch.proftext +++ b/llvm/test/tools/llvm-profdata/hash-mismatch.proftext @@ -2,7 +2,7 @@ # sure we keep both. # RUN: llvm-profdata merge %s -o %t 2>&1 -# RUN: llvm-profdata show %t --all-functions --counts > %t.out +# RUN: llvm-profdata show %t -all-functions -counts > %t.out # The function ordering is non-deterministic, so we need to do our # checks in multiple runs. diff --git a/llvm/test/tools/llvm-profdata/help.test b/llvm/test/tools/llvm-profdata/help.test index b1b3673591e45..cc2fead5e0b8e 100644 --- a/llvm/test/tools/llvm-profdata/help.test +++ b/llvm/test/tools/llvm-profdata/help.test @@ -11,12 +11,12 @@ # MERGE: OVERVIEW: LLVM profile data # MERGE: Takes several profiles and merge them together. # MERGE: OPTIONS: -# MERGE-DAG: --instr -# MERGE-DAG: --output -# MERGE-DAG: --sample +# MERGE-DAG: -instr +# MERGE-DAG: -output +# MERGE-DAG: -sample # SHOW: OVERVIEW: LLVM profile data # SHOW: Takes a profile data file and displays the profiles. # SHOW: OPTIONS: -# SHOW-DAG: --output +# SHOW-DAG: -output # SHOW-DAG: --show-format diff --git a/llvm/test/tools/llvm-profdata/input-dir.test b/llvm/test/tools/llvm-profdata/input-dir.test index f90eebf120231..515ab3e8f3674 100644 --- a/llvm/test/tools/llvm-profdata/input-dir.test +++ b/llvm/test/tools/llvm-profdata/input-dir.test @@ -12,8 +12,8 @@ RUN: echo ' ' > %t.dir2/bar RUN: echo ' ' > %t.dir2/foo RUN: echo ' ' > %t.dir2/subdir/baz -RUN: llvm-profdata merge -f %t.input --dump-input-file-list -o /dev/null | FileCheck %s -RUN: llvm-profdata merge --weighted-input 2,%t.dir2 --dump-input-file-list -o /dev/null %t.dir1 | FileCheck %s +RUN: llvm-profdata merge -f %t.input -dump-input-file-list -o /dev/null | FileCheck %s +RUN: llvm-profdata merge -weighted-input 2,%t.dir2 -dump-input-file-list -o /dev/null %t.dir1 | FileCheck %s CHECK-DAG: 1,{{.*}}.dir1{{[/\\]}}bar CHECK-DAG: 1,{{.*}}.dir1{{[/\\]}}foo diff --git a/llvm/test/tools/llvm-profdata/input-filenames.test b/llvm/test/tools/llvm-profdata/input-filenames.test index 048f940bd97f2..4f29e7bea9b8f 100644 --- a/llvm/test/tools/llvm-profdata/input-filenames.test +++ b/llvm/test/tools/llvm-profdata/input-filenames.test @@ -10,8 +10,8 @@ RUN: echo ' ' > %t.foo RUN: echo ' ' > %t.bar RUN: echo ' ' > %t.baz -RUN: llvm-profdata merge -f %t.input --dump-input-file-list -o /dev/null %t.foo | FileCheck %s -RUN: llvm-profdata merge --input-files %t.input --dump-input-file-list -o /dev/null %t.foo | FileCheck %s +RUN: llvm-profdata merge -f %t.input -dump-input-file-list -o /dev/null %t.foo | FileCheck %s +RUN: llvm-profdata merge -input-files %t.input -dump-input-file-list -o /dev/null %t.foo | FileCheck %s CHECK: 1,{{.*}}.foo CHECK-NEXT: 1,{{.*}}.bar diff --git a/llvm/test/tools/llvm-profdata/input-wildcard.test b/llvm/test/tools/llvm-profdata/input-wildcard.test index 115aa209012d2..f2c46c962a817 100644 --- a/llvm/test/tools/llvm-profdata/input-wildcard.test +++ b/llvm/test/tools/llvm-profdata/input-wildcard.test @@ -8,7 +8,7 @@ RUN: echo '# empty profile 1' > %t.prof1.proftxt RUN: echo '# empty profile 2' >> %t.prof2.proftxt # Prevent LIT itself from globbing by quoting the wildcard argument. -RUN: llvm-profdata merge "%t.*.proftxt" --dump-input-file-list -o /dev/null | FileCheck %s +RUN: llvm-profdata merge "%t.*.proftxt" -dump-input-file-list -o /dev/null | FileCheck %s # Verify that llvm-profdata expanded the wildcard argument. CHECK: 1,{{.*}}.prof1.proftxt diff --git a/llvm/test/tools/llvm-profdata/instr-remap.test b/llvm/test/tools/llvm-profdata/instr-remap.test index 82189b110dba4..27fddf6095812 100644 --- a/llvm/test/tools/llvm-profdata/instr-remap.test +++ b/llvm/test/tools/llvm-profdata/instr-remap.test @@ -1,2 +1,2 @@ -; RUN: llvm-profdata merge --text %S/Inputs/instr-remap.proftext -r %S/Inputs/instr-remap.remap -o %t.output +; RUN: llvm-profdata merge -text %S/Inputs/instr-remap.proftext -r %S/Inputs/instr-remap.remap -o %t.output ; RUN: diff -b %S/Inputs/instr-remap.expected %t.output diff --git a/llvm/test/tools/llvm-profdata/invalid-profdata.test b/llvm/test/tools/llvm-profdata/invalid-profdata.test index 29006248272b7..efa16392e42e7 100644 --- a/llvm/test/tools/llvm-profdata/invalid-profdata.test +++ b/llvm/test/tools/llvm-profdata/invalid-profdata.test @@ -20,7 +20,7 @@ RUN: echo "f2:0" >> %t.input RUN: echo "1" >> %t.input RUN: echo ":10" >> %t.input -RUN: not llvm-profdata merge %t.input --text -o /dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN +RUN: not llvm-profdata merge %t.input -text -output=/dev/null 2>&1 | FileCheck %s --check-prefix=BROKEN BROKEN: warning: {{.*}}invalid-profdata.test.tmp.input: malformed instrumentation profile data BROKEN-NEXT: error: no profile can be merged @@ -46,6 +46,6 @@ RUN: echo "f2:0" >> %t.input RUN: echo "1" >> %t.input RUN: echo "** External Symbol **:10" >> %t.input -# RUN: llvm-profdata merge %t.input --text -o %t.out && cat %t.out | FileCheck %s +# RUN: llvm-profdata merge %t.input -text -output=%t.out && cat %t.out | FileCheck %s CHECK: ** External Symbol **:10 diff --git a/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test b/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test index bd7159f0bea18..416abde7b4dd7 100644 --- a/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test +++ b/llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test @@ -80,13 +80,13 @@ RUN: printf '\3\0foo\0\0\0' >> %t-good.profraw RUN: not llvm-profdata merge %t-bad.profraw %t-good.profraw -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ANY ANY: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -// --failure-mode all only fails if there is a warning for every input file. -RUN: not llvm-profdata merge %t-bad.profraw --failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-ERR +// -failure-mode all only fails if there is a warning for every input file. +RUN: not llvm-profdata merge %t-bad.profraw -failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-ERR ALL-ERR: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -RUN: llvm-profdata merge %t-bad.profraw %t-good.profraw --failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-WARN +RUN: llvm-profdata merge %t-bad.profraw %t-good.profraw -failure-mode all -o %t.profdata 2>&1 | FileCheck %s --check-prefix=ALL-WARN ALL-WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 -// --failure-mode warn does not fail at all. It only prints warnings. -RUN: llvm-profdata merge %t-bad.profraw --failure-mode warn -o %t.profdata 2>&1 | FileCheck %s --check-prefix=WARN +// -failure-mode warn does not fail at all. It only prints warnings. +RUN: llvm-profdata merge %t-bad.profraw -failure-mode warn -o %t.profdata 2>&1 | FileCheck %s --check-prefix=WARN WARN: {{.*}} excessively large counter value suggests corrupted profile data: 72057594037927937 diff --git a/llvm/test/tools/llvm-profdata/mcdc-bitmap.test b/llvm/test/tools/llvm-profdata/mcdc-bitmap.test index 9df65002df52d..a7b1b5df8c306 100644 --- a/llvm/test/tools/llvm-profdata/mcdc-bitmap.test +++ b/llvm/test/tools/llvm-profdata/mcdc-bitmap.test @@ -3,10 +3,10 @@ # Merge as profdata. RUN: split-file %s %t RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.profdata -RUN: llvm-profdata show %t.profdata --text --all-functions | FileCheck %s --check-prefix=MCDC +RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC # Merge as proftext. RUN: llvm-profdata merge %t/mcdc-1.proftext %t/mcdc-2.proftext -o %t.proftext -RUN: llvm-profdata show %t.proftext --text --all-functions | FileCheck %s --check-prefix=MCDC +RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC MCDC: # Num Bitmap Bytes: MCDC-NEXT: $1 @@ -20,10 +20,10 @@ MCDC-NEXT: 0x0 # Merge as profdata. RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.profdata -RUN: llvm-profdata show %t.profdata --text --all-functions | FileCheck %s --check-prefix=MCDC2 +RUN: llvm-profdata show %t.profdata --text -all-functions | FileCheck %s --check-prefix=MCDC2 # Merge as proftext. RUN: llvm-profdata merge %t/mcdc-3.proftext %t/mcdc-4.proftext -o %t.proftext -RUN: llvm-profdata show %t.proftext --text --all-functions | FileCheck %s --check-prefix=MCDC2 +RUN: llvm-profdata show %t.proftext --text -all-functions | FileCheck %s --check-prefix=MCDC2 MCDC2: # Num Bitmap Bytes: MCDC2-NEXT: $8 diff --git a/llvm/test/tools/llvm-profdata/memop-size-prof.proftext b/llvm/test/tools/llvm-profdata/memop-size-prof.proftext index fa8eb623bb337..4c6c61870a312 100644 --- a/llvm/test/tools/llvm-profdata/memop-size-prof.proftext +++ b/llvm/test/tools/llvm-profdata/memop-size-prof.proftext @@ -1,9 +1,9 @@ -# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %s | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM -# RUN: llvm-profdata show --memop-sizes --ic-targets --counts --text --function foo %s | FileCheck %s --check-prefixes=TEXT,MEMOP_TEXT,ICALL_TEXT +# RUN: llvm-profdata show -memop-sizes -ic-targets -function foo %s | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata show -memop-sizes -ic-targets -counts -text -function foo %s | FileCheck %s --check-prefixes=TEXT,MEMOP_TEXT,ICALL_TEXT # RUN: llvm-profdata merge -o %t.profdata %s -# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %t.profdata | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM -# RUN: llvm-profdata merge -o %t.proftext --text %s -# RUN: llvm-profdata show --memop-sizes --ic-targets --function foo %t.proftext| FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata show -memop-sizes -ic-targets -function foo %t.profdata | FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM +# RUN: llvm-profdata merge -o %t.proftext -text %s +# RUN: llvm-profdata show -memop-sizes -ic-targets -function foo %t.proftext| FileCheck %s --check-prefixes=MEMOP,MEMOP_SUM,ICALL,ICALL_SUM # IR level Instrumentation Flag :ir diff --git a/llvm/test/tools/llvm-profdata/merge-filter.test b/llvm/test/tools/llvm-profdata/merge-filter.test index fecd127d73f9d..87cb24d435248 100644 --- a/llvm/test/tools/llvm-profdata/merge-filter.test +++ b/llvm/test/tools/llvm-profdata/merge-filter.test @@ -8,7 +8,7 @@ CHECK-NEXT: _Z3fooi:7711:610 CHECK-NEXT: 1: 610 CHECK-NOT: main -RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text --function "_Z3.*" --no-function "fooi$" | FileCheck %s --check-prefix=CHECK-FILTER2 +RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --text -function "_Z3.*" --no-function "fooi$" | FileCheck %s --check-prefix=CHECK-FILTER2 CHECK-FILTER2: _Z3bari:20301:1437 CHECK-NEXT: 1: 1437 CHECK-NOT: main @@ -41,7 +41,7 @@ CHECK-NEXT: # Counter Values: CHECK-NEXT: 500500 CHECK-NEXT: 180100 -RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text --function "foo" --no-function "^foo$" | FileCheck %s --check-prefix=CHECK-FILTER4 +RUN: llvm-profdata merge --instr %p/Inputs/basic.proftext --text -function "foo" --no-function "^foo$" | FileCheck %s --check-prefix=CHECK-FILTER4 CHECK-FILTER4: foo2 CHECK-NEXT: # Func Hash: CHECK-NEXT: 10 @@ -51,7 +51,7 @@ CHECK-NEXT: # Counter Values: CHECK-NEXT: 500500 CHECK-NEXT: 180100 -RUN: llvm-profdata merge --sample %p/Inputs/cs-sample.proftext --text --function "main.*@.*_Z5funcBi" | FileCheck %s --check-prefix=CHECK-FILTER5 +RUN: llvm-profdata merge -sample %p/Inputs/cs-sample.proftext --text --function "main.*@.*_Z5funcBi" | FileCheck %s --check-prefix=CHECK-FILTER5 CHECK-FILTER5: [main:3.1 @ _Z5funcBi:1 @ _Z8funcLeafi]:500853:20 CHECK-NEXT: 0: 15 CHECK-NEXT: 1: 15 diff --git a/llvm/test/tools/llvm-profdata/merge-probe-profile.test b/llvm/test/tools/llvm-profdata/merge-probe-profile.test index a64750429452a..b69a5feb680b3 100644 --- a/llvm/test/tools/llvm-profdata/merge-probe-profile.test +++ b/llvm/test/tools/llvm-profdata/merge-probe-profile.test @@ -23,5 +23,5 @@ MERGE2: 5: 14 _Z3foov:10 _Z3barv:4 MERGE2: 6: 12 _Z3barv:8 _Z3foov:4 MERGE2: !CFGChecksum: 563022570642068 -RUN: llvm-profdata show --sample --show-sec-info-only %t | FileCheck %s -CHECK: FunctionMetadata {{.*}} Flags: {probe} \ No newline at end of file +RUN: llvm-profdata show --sample -show-sec-info-only %t | FileCheck %s +CHECK: FunctionMetadata {{.*}} Flags: {probe} diff --git a/llvm/test/tools/llvm-profdata/merge_empty_profile.test b/llvm/test/tools/llvm-profdata/merge_empty_profile.test index 3cc6c725c2cdf..922f6bbb297c3 100644 --- a/llvm/test/tools/llvm-profdata/merge_empty_profile.test +++ b/llvm/test/tools/llvm-profdata/merge_empty_profile.test @@ -1,15 +1,15 @@ # Tests for merge of empty profile files. RUN: touch %t_empty.proftext -RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext | FileCheck %s -check-prefix=CLANG_PROF_TEXT -RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=CLANG_PROF_TEXT +RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext | FileCheck %s -check-prefix=CLANG_PROF_TEXT +RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/clang_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=CLANG_PROF_TEXT CLANG_PROF_TEXT: main CLANG_PROF_TEXT: 0 CLANG_PROF_TEXT: 1 CLANG_PROF_TEXT: 1 -RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext | FileCheck %s -check-prefix=IR_PROF_TEXT -RUN: llvm-profdata merge --text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=IR_PROF_TEXT +RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext | FileCheck %s -check-prefix=IR_PROF_TEXT +RUN: llvm-profdata merge -text -o - %t_empty.proftext %p/Inputs/IR_profile.proftext --num-threads 2 | FileCheck %s -check-prefix=IR_PROF_TEXT IR_PROF_TEXT: :ir IR_PROF_TEXT: main IR_PROF_TEXT: 0 diff --git a/llvm/test/tools/llvm-profdata/multiple-inputs.test b/llvm/test/tools/llvm-profdata/multiple-inputs.test index d2d93a6459e7e..3a3caeac0c2e3 100644 --- a/llvm/test/tools/llvm-profdata/multiple-inputs.test +++ b/llvm/test/tools/llvm-profdata/multiple-inputs.test @@ -1,9 +1,9 @@ Some very basic tests for the multiple input cases. RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-2.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 RUN: llvm-profdata merge %p/Inputs/foo3-2.proftext %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3 FOO3: foo: FOO3: Counters: 3 FOO3: Function count: 8 @@ -13,7 +13,7 @@ FOO3: Maximum function count: 8 FOO3: Maximum internal block count: 7 RUN: llvm-profdata merge %p/Inputs/empty.proftext %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO3EMPTY +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO3EMPTY FOO3EMPTY: foo: FOO3EMPTY: Counters: 3 FOO3EMPTY: Function count: 1 @@ -23,8 +23,8 @@ FOO3EMPTY: Maximum function count: 1 FOO3EMPTY: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3bar3-1.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-1 -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-2 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-1 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=FOO3FOO3BAR3,FOO3FOO3BAR3-2 FOO3FOO3BAR3-1: foo: FOO3FOO3BAR3-1: Counters: 3 FOO3FOO3BAR3-1: Function count: 3 @@ -38,8 +38,8 @@ FOO3FOO3BAR3: Maximum function count: 7 FOO3FOO3BAR3: Maximum internal block count: 13 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/bar3-1.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-1 -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-2 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-1 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefixes=DISJOINT,DISJOINT-2 DISJOINT-1: foo: DISJOINT-1: Counters: 3 DISJOINT-1: Function count: 1 @@ -54,12 +54,12 @@ DISJOINT: Maximum internal block count: 3 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ -RUN: --num-threads 2 -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO4 +RUN: -num-threads 2 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: -j 3 -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO4 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 FOO4: foo: FOO4: Counters: 3 FOO4: Function count: 4 @@ -71,19 +71,19 @@ FOO4: Maximum internal block count: 12 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 2 -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 3 -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ RUN: %p/Inputs/foo3-1.proftext -j 1 -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 FOO5: foo: FOO5: Counters: 3 FOO5: Function count: 5 diff --git a/llvm/test/tools/llvm-profdata/overflow-instr.test b/llvm/test/tools/llvm-profdata/overflow-instr.test index c4980b758b104..5541a67dc5f3e 100644 --- a/llvm/test/tools/llvm-profdata/overflow-instr.test +++ b/llvm/test/tools/llvm-profdata/overflow-instr.test @@ -1,15 +1,15 @@ Tests for overflow when merging instrumented profiles. 1- Merge profile having maximum counts with itself and verify overflow detected and saturation occurred -RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -RUN: llvm-profdata show --instr --all-functions --counts %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW +RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW +RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW MERGE_OVERFLOW: {{.*}}.proftext: overflow: counter overflow SHOW_OVERFLOW: Function count: 18446744073709551613 SHOW_OVERFLOW-NEXT: Block counts: [18446744073709551613, 18446744073709551613] 2- Merge profile having maximum counts by itself and verify no overflow -RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW +RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_NO_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW MERGE_NO_OVERFLOW-NOT: {{.*}}.proftext: overflow: counter overflow SHOW_NO_OVERFLOW: Function count: 18446744073709551613 SHOW_NO_OVERFLOW-NEXT: Block counts: [9223372036854775808, 18446744073709551613] diff --git a/llvm/test/tools/llvm-profdata/overflow-sample.test b/llvm/test/tools/llvm-profdata/overflow-sample.test index 5d1877972f0cd..83adf6d63b549 100644 --- a/llvm/test/tools/llvm-profdata/overflow-sample.test +++ b/llvm/test/tools/llvm-profdata/overflow-sample.test @@ -1,8 +1,8 @@ Tests for overflow when merging sampled profiles. 1- Merge profile having maximum counts with itself and verify overflow detected -RUN: llvm-profdata merge --sample %p/Inputs/overflow-sample.proftext %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -RUN: llvm-profdata show --sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW +RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW +RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_OVERFLOW MERGE_OVERFLOW: {{.*}}: main: Counter overflow SHOW_OVERFLOW-DAG: Function: main: 2000, 0, 2 sampled lines SHOW_OVERFLOW-DAG: Samples collected in the function's body { @@ -22,8 +22,8 @@ SHOW_OVERFLOW-DAG: } SHOW_OVERFLOW-DAG: No inlined callsites in this function 2- Merge profile having maximum counts by itself and verify no overflow -RUN: llvm-profdata merge --sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW -RUN: llvm-profdata show --sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW +RUN: llvm-profdata merge -sample %p/Inputs/overflow-sample.proftext -o %t.out 2>&1 | FileCheck %s -allow-empty -check-prefix=MERGE_NO_OVERFLOW +RUN: llvm-profdata show -sample %t.out | FileCheck %s --check-prefix=SHOW_NO_OVERFLOW MERGE_NO_OVERFLOW-NOT: {{.*}}: main: Counter overflow SHOW_NO_OVERFLOW-DAG: Function: main: 1000, 0, 2 sampled lines SHOW_NO_OVERFLOW-DAG: Samples collected in the function's body { diff --git a/llvm/test/tools/llvm-profdata/overlap.test b/llvm/test/tools/llvm-profdata/overlap.test index dd59b63e52a3e..1d94a0dafea11 100644 --- a/llvm/test/tools/llvm-profdata/overlap.test +++ b/llvm/test/tools/llvm-profdata/overlap.test @@ -1,6 +1,6 @@ RUN: llvm-profdata overlap %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s -check-prefix=OVERLAP -RUN: llvm-profdata overlap --function main %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP -RUN: llvm-profdata overlap --value-cutoff 15000 %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP +RUN: llvm-profdata overlap -function main %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP +RUN: llvm-profdata overlap -value-cutoff 15000 %p/Inputs/overlap_1.proftext %p/Inputs/overlap_2.proftext | FileCheck %s --check-prefixes=MAINFUNC,OVERLAP RUN: llvm-profdata merge %p/Inputs/overlap_1.proftext -o %t_1.profdata RUN: llvm-profdata merge %p/Inputs/overlap_2.proftext -o %t_2.profdata RUN: llvm-profdata overlap %t_1.profdata %t_2.profdata | FileCheck %s -check-prefix=OVERLAP diff --git a/llvm/test/tools/llvm-profdata/overlap_cs.test b/llvm/test/tools/llvm-profdata/overlap_cs.test index 289d2b69850e1..ba15418f87da8 100644 --- a/llvm/test/tools/llvm-profdata/overlap_cs.test +++ b/llvm/test/tools/llvm-profdata/overlap_cs.test @@ -1,7 +1,7 @@ -RUN: llvm-profdata overlap --cs %p/Inputs/overlap_1_cs.proftext %p/Inputs/overlap_2_cs.proftext | FileCheck %s -check-prefix=OVERLAP +RUN: llvm-profdata overlap -cs %p/Inputs/overlap_1_cs.proftext %p/Inputs/overlap_2_cs.proftext | FileCheck %s -check-prefix=OVERLAP RUN: llvm-profdata merge %p/Inputs/overlap_1_cs.proftext -o %t_1_cs.profdata RUN: llvm-profdata merge %p/Inputs/overlap_2_cs.proftext -o %t_2_cs.profdata -RUN: llvm-profdata overlap --cs %t_1_cs.profdata %t_2_cs.profdata | FileCheck %s -check-prefix=OVERLAP +RUN: llvm-profdata overlap -cs %t_1_cs.profdata %t_2_cs.profdata | FileCheck %s -check-prefix=OVERLAP OVERLAP: Profile overlap information for base_profile: {{.*}} and test_profile: OVERLAP: Program level: OVERLAP: # of functions overlap: 1 diff --git a/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test b/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test index d6dac11a15f10..127fadfcddc8b 100644 --- a/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test +++ b/llvm/test/tools/llvm-profdata/profile-symbol-list-compress.test @@ -1,15 +1,15 @@ REQUIRES: zlib -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --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 --compress-all-sections --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -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 -compress-all-sections -prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list.expected %t.4.output ;; Generate two SampleFDO binary profiles and merge them. ;; Tests that the vtable counters in the merged profile are the aggregated ;; result from both sources. -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output -; RUN: llvm-profdata merge --sample --extbinary --compress-all-sections --extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof -prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof -prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output +; RUN: llvm-profdata merge -sample -extbinary -compress-all-sections -extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list-ext.expected %t.4.output diff --git a/llvm/test/tools/llvm-profdata/profile-symbol-list.test b/llvm/test/tools/llvm-profdata/profile-symbol-list.test index a51a653860c0c..a61c946c51323 100644 --- a/llvm/test/tools/llvm-profdata/profile-symbol-list.test +++ b/llvm/test/tools/llvm-profdata/profile-symbol-list.test @@ -1,18 +1,18 @@ -; RUN: llvm-profdata merge --sample --extbinary --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 --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output -; RUN: llvm-profdata merge --sample --extbinary %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge -sample -extbinary -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 -prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile.proftext -o %t.2.output +; RUN: llvm-profdata merge -sample -extbinary %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list.expected %t.4.output -; RUN: llvm-profdata merge --sample --extbinary --drop-profile-symbol-list %t.1.output %t.2.output -o %t.5.output -; RUN: llvm-profdata show --sample --show-sec-info-only %t.5.output | FileCheck %s -check-prefix=NOSYMLIST +; RUN: llvm-profdata merge -sample -extbinary --drop-profile-symbol-list %t.1.output %t.2.output -o %t.5.output +; RUN: llvm-profdata show -sample -show-sec-info-only %t.5.output | FileCheck %s -check-prefix=NOSYMLIST ; NOSYMLIST: ProfileSymbolListSection {{.*}} Size: 0 ;; Generate two SampleFDO binary profiles and merge them. ;; Tests that the vtable counters in the merged profile are the aggregated ;; result from both sources. -; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output -; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof --prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output -; RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output -; RUN: llvm-profdata show --sample --show-prof-sym-list %t.3.output > %t.4.output +; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof -prof-sym-list %S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile-ext.proftext -o %t.1.output +; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof -prof-sym-list %S/Inputs/profile-symbol-list-2.text %S/Inputs/sample-profile-ext.proftext -o %t.2.output +; RUN: llvm-profdata merge -sample -extbinary -extbinary-write-vtable-type-prof %t.1.output %t.2.output -o %t.3.output +; RUN: llvm-profdata show -sample -show-prof-sym-list %t.3.output > %t.4.output ; RUN: diff -b %S/Inputs/profile-symbol-list-ext.expected %t.4.output diff --git a/llvm/test/tools/llvm-profdata/pseudo_count.test b/llvm/test/tools/llvm-profdata/pseudo_count.test index 61f85bb9dd67f..7915866d3270f 100644 --- a/llvm/test/tools/llvm-profdata/pseudo_count.test +++ b/llvm/test/tools/llvm-profdata/pseudo_count.test @@ -1,17 +1,17 @@ Tests for merging instrumented profiles with pseudo counts. -RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-warm.proftext -o %t1.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t1.out | FileCheck %s --check-prefix=MERGE_WARM -RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-warm.proftext %p/Inputs/pseudo-count-warm.proftext -o %t2.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t2.out | FileCheck %s --check-prefix=MERGE_WARM -RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext -o %t3.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t3.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-hot.proftext -o %t4.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t4.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge --instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-warm.proftext -o %t5.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty -RUN: llvm-profdata show --instr --all-functions --counts %t5.out | FileCheck %s --check-prefix=MERGE_HOT -RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-warm.proftext -o %t6.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING -RUN: llvm-profdata merge --instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-hot.proftext -o %t7.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING +RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-warm.proftext -o %t1.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t1.out | FileCheck %s --check-prefix=MERGE_WARM +RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-warm.proftext %p/Inputs/pseudo-count-warm.proftext -o %t2.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t2.out | FileCheck %s --check-prefix=MERGE_WARM +RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext -o %t3.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t3.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-hot.proftext -o %t4.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t4.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge -instr %p/Inputs/pseudo-count-hot.proftext %p/Inputs/pseudo-count-warm.proftext -o %t5.out 2>&1 | FileCheck %s -check-prefix=MERGE_OVERFLOW -allow-empty +RUN: llvm-profdata show -instr -all-functions -counts %t5.out | FileCheck %s --check-prefix=MERGE_HOT +RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-warm.proftext -o %t6.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING +RUN: llvm-profdata merge -instr %p/Inputs/overflow-instr.proftext %p/Inputs/pseudo-count-hot.proftext -o %t7.out 2>&1 | FileCheck %s -check-prefix=MERGE_WARNING MERGE_OVERFLOW-NOT: {{.*}}.proftext: overflow: counter overflow MERGE_WARM: Counters: 3 diff --git a/llvm/test/tools/llvm-profdata/raw-32-bits-be.test b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test index 218e17a7ba0a6..6b3dc96b36270 100644 --- a/llvm/test/tools/llvm-profdata/raw-32-bits-be.test +++ b/llvm/test/tools/llvm-profdata/raw-32-bits-be.test @@ -45,8 +45,8 @@ RUN: printf '\0\0\0\0\0\0\0\101' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s -RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-32-bits-le.test b/llvm/test/tools/llvm-profdata/raw-32-bits-le.test index 0bbd13ce763a7..95625565f5c0c 100644 --- a/llvm/test/tools/llvm-profdata/raw-32-bits-le.test +++ b/llvm/test/tools/llvm-profdata/raw-32-bits-le.test @@ -44,8 +44,8 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s -RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-64-bits-be.test b/llvm/test/tools/llvm-profdata/raw-64-bits-be.test index c10a65e657779..5316ef5a3e559 100644 --- a/llvm/test/tools/llvm-profdata/raw-64-bits-be.test +++ b/llvm/test/tools/llvm-profdata/raw-64-bits-be.test @@ -44,8 +44,8 @@ RUN: printf '\0\0\0\0\0\0\0\101' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s -RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-64-bits-le.test b/llvm/test/tools/llvm-profdata/raw-64-bits-le.test index 4f55d82a6c53f..58f4da8cf0386 100644 --- a/llvm/test/tools/llvm-profdata/raw-64-bits-le.test +++ b/llvm/test/tools/llvm-profdata/raw-64-bits-le.test @@ -44,8 +44,8 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t RUN: printf '\125\125\125\052' >> %t RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s -RUN: llvm-profdata show %t --all-functions --text | FileCheck %s -check-prefix=MCDC +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s +RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/raw-two-profiles.test b/llvm/test/tools/llvm-profdata/raw-two-profiles.test index 7706664713d94..47cc6fa4fd7fe 100644 --- a/llvm/test/tools/llvm-profdata/raw-two-profiles.test +++ b/llvm/test/tools/llvm-profdata/raw-two-profiles.test @@ -61,7 +61,7 @@ RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw RUN: printf '\3\0bar\0\0\0' >> %t-bar.profraw RUN: cat %t-foo.profraw %t-bar.profraw > %t-pad.profraw -RUN: llvm-profdata show %t-pad.profraw --all-functions --counts | FileCheck %s +RUN: llvm-profdata show %t-pad.profraw -all-functions -counts | FileCheck %s CHECK: Counters: CHECK: foo: diff --git a/llvm/test/tools/llvm-profdata/read-traces.proftext b/llvm/test/tools/llvm-profdata/read-traces.proftext index 79e961cf03ce1..5e822a9ea53ec 100644 --- a/llvm/test/tools/llvm-profdata/read-traces.proftext +++ b/llvm/test/tools/llvm-profdata/read-traces.proftext @@ -1,9 +1,9 @@ -# RUN: llvm-profdata merge --text %s -o %t.1.proftext -# RUN: llvm-profdata merge --binary %t.1.proftext -o %t.2.profdata -# RUN: llvm-profdata merge --text %t.2.profdata -o %t.3.proftext +# RUN: llvm-profdata merge -text %s -o %t.1.proftext +# RUN: llvm-profdata merge -binary %t.1.proftext -o %t.2.profdata +# RUN: llvm-profdata merge -text %t.2.profdata -o %t.3.proftext # RUN: diff %t.1.proftext %t.3.proftext -# RUN: llvm-profdata merge --text %s | FileCheck %s +# RUN: llvm-profdata merge -text %s | FileCheck %s # CHECK: :temporal_prof_traces # CHECK: # Num Temporal Profile Traces: diff --git a/llvm/test/tools/llvm-profdata/roundtrip-compress.test b/llvm/test/tools/llvm-profdata/roundtrip-compress.test index 56bafe752a610..699fd4829382f 100644 --- a/llvm/test/tools/llvm-profdata/roundtrip-compress.test +++ b/llvm/test/tools/llvm-profdata/roundtrip-compress.test @@ -1,10 +1,10 @@ REQUIRES: zlib # Round trip from text --> compressed extbinary --> text -RUN: llvm-profdata merge --sample --extbinary --compress-all-sections -o %t.1.profdata %S/Inputs/sample-profile.proftext +RUN: llvm-profdata merge --sample --extbinary -compress-all-sections -o %t.1.profdata %S/Inputs/sample-profile.proftext RUN: llvm-profdata merge --sample --text -o %t.1.proftext %t.1.profdata RUN: diff -b %t.1.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> binary --> compressed extbinary --> text RUN: llvm-profdata merge --sample --binary -o %t.2.profdata %S/Inputs/sample-profile.proftext -RUN: llvm-profdata merge --sample --extbinary --compress-all-sections -o %t.3.profdata %t.2.profdata +RUN: llvm-profdata merge --sample --extbinary -compress-all-sections -o %t.3.profdata %t.2.profdata RUN: llvm-profdata merge --sample --text -o %t.2.proftext %t.3.profdata RUN: diff -b %t.2.proftext %S/Inputs/sample-profile.proftext diff --git a/llvm/test/tools/llvm-profdata/roundtrip.test b/llvm/test/tools/llvm-profdata/roundtrip.test index 2351a0deff0db..ab1b2d30cf5dd 100644 --- a/llvm/test/tools/llvm-profdata/roundtrip.test +++ b/llvm/test/tools/llvm-profdata/roundtrip.test @@ -1,8 +1,8 @@ RUN: llvm-profdata merge -o %t.0.profdata %S/Inputs/IR_profile.proftext -RUN: llvm-profdata show -o %t.0.proftext --all-functions --text %t.0.profdata +RUN: llvm-profdata show -o %t.0.proftext -all-functions -text %t.0.profdata RUN: diff -b %t.0.proftext %S/Inputs/IR_profile.proftext RUN: llvm-profdata merge -o %t.1.profdata %t.0.proftext -RUN: llvm-profdata show -o %t.1.proftext --all-functions --text %t.1.profdata +RUN: llvm-profdata show -o %t.1.proftext -all-functions -text %t.1.profdata RUN: diff -b %t.1.proftext %S/Inputs/IR_profile.proftext RUN: llvm-profdata merge --sample --binary -o %t.2.profdata %S/Inputs/sample-profile.proftext RUN: llvm-profdata merge --sample --text -o %t.2.proftext %t.2.profdata @@ -19,6 +19,6 @@ RUN: diff -b %t.4.proftext %S/Inputs/sample-profile.proftext # Round trip from text --> extbinary --> text. # The vtable profile is supported by ext-binary profile but not raw binary profile format, # so we don't use raw binary profile format in this roundtrip. -RUN: llvm-profdata merge --sample --extbinary --extbinary-write-vtable-type-prof -o %t.5.profdata %S/Inputs/sample-profile-ext.proftext +RUN: llvm-profdata merge --sample --extbinary -extbinary-write-vtable-type-prof -o %t.5.profdata %S/Inputs/sample-profile-ext.proftext RUN: llvm-profdata merge --sample --text -o %t.5.proftext %t.5.profdata RUN: diff -b %t.5.proftext %S/Inputs/sample-profile-ext.proftext diff --git a/llvm/test/tools/llvm-profdata/same-filename.test b/llvm/test/tools/llvm-profdata/same-filename.test index d2d95761e260f..1bb437b844ec6 100644 --- a/llvm/test/tools/llvm-profdata/same-filename.test +++ b/llvm/test/tools/llvm-profdata/same-filename.test @@ -2,13 +2,13 @@ Test the input file names overlap with the output file names. This is OK for merging instrument profiles. RUN: cp %S/Inputs/same-name-1.proftext %t.0.proftext -RUN: llvm-profdata merge -o %t.0.profdata --text %t.0.proftext %t.0.proftext -RUN: llvm-profdata show --counts --all-functions %t.0.profdata -o %t_show_0 -RUN: llvm-profdata show --counts --all-functions %S/Inputs/same-name-2.proftext -o %t_show_1 +RUN: llvm-profdata merge -o %t.0.profdata -text %t.0.proftext %t.0.proftext +RUN: llvm-profdata show -counts -all-functions %t.0.profdata -o %t_show_0 +RUN: llvm-profdata show -counts -all-functions %S/Inputs/same-name-2.proftext -o %t_show_1 RUN: diff %t_show_0 %t_show_1 RUN: llvm-profdata merge -o %t.1.profdata %S/Inputs/same-name-1.proftext RUN: llvm-profdata merge -o %t.1.profdata %t.1.profdata %t.1.profdata -RUN: llvm-profdata show --counts --all-functions %t.1.profdata -o %t_show_2 +RUN: llvm-profdata show -counts -all-functions %t.1.profdata -o %t_show_2 RUN: diff %t_show_2 %t_show_1 We report error for the show command. @@ -17,11 +17,11 @@ CHECK: llvm-profdata{{.*}} show: Input file name cannot be the same as the outpu This is OK for merging sample fdo profiles. RUN: cp %S/Inputs/same-name-3.proftext %t.3.proftext -RUN: llvm-profdata merge --sample -o %t.3.profdata --text %t.3.proftext %t.3.proftext -RUN: llvm-profdata show --sample --counts --all-functions %t.3.profdata -o %t_show_3 -RUN: llvm-profdata show --sample --counts --all-functions %S/Inputs/same-name-4.proftext -o %t_show_4 +RUN: llvm-profdata merge --sample -o %t.3.profdata -text %t.3.proftext %t.3.proftext +RUN: llvm-profdata show --sample -counts -all-functions %t.3.profdata -o %t_show_3 +RUN: llvm-profdata show --sample -counts -all-functions %S/Inputs/same-name-4.proftext -o %t_show_4 RUN: diff %t_show_3 %t_show_4 RUN: llvm-profdata merge --sample -o %t.5.profdata %S/Inputs/same-name-3.proftext RUN: llvm-profdata merge --sample -o %t.5.profdata %t.5.profdata %t.5.profdata -RUN: llvm-profdata show --sample --counts --all-functions %t.5.profdata -o %t_show_6 +RUN: llvm-profdata show --sample -counts -all-functions %t.5.profdata -o %t_show_6 RUN: diff %t_show_6 %t_show_4 diff --git a/llvm/test/tools/llvm-profdata/sample-fs.test b/llvm/test/tools/llvm-profdata/sample-fs.test index 2146556b81568..b52da76191cc1 100644 --- a/llvm/test/tools/llvm-profdata/sample-fs.test +++ b/llvm/test/tools/llvm-profdata/sample-fs.test @@ -1,8 +1,8 @@ Basic tests for sample profiles using fs discriminators. 1- Show command and keep all the discrimiantor bits -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs | FileCheck %s --check-prefix=SHOW1 -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass PassLast | FileCheck %s --check-prefix=SHOW1 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs | FileCheck %s --check-prefix=SHOW1 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass PassLast | FileCheck %s --check-prefix=SHOW1 SHOW1: Function: main: 6436, 0, 6 sampled lines SHOW1: Samples collected in the function's body { SHOW1: 4: 534 @@ -14,7 +14,7 @@ SHOW1: 5.738209025: 2150 SHOW1: } 2- Show command and keep only the base discriminator bits -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base | FileCheck %s --check-prefix=SHOW2 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Base | FileCheck %s --check-prefix=SHOW2 SHOW2: Function: main: 6436, 0, 4 sampled lines SHOW2: Samples collected in the function's body { SHOW2: 4: 534 @@ -24,7 +24,7 @@ SHOW2: 5.1: 3225 SHOW2: } 3- Show command and keep only the base discriminator bits and first pass of FS discriminator -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 | FileCheck %s --check-prefix=SHOW3 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Pass1 | FileCheck %s --check-prefix=SHOW3 Function: main: 6436, 0, 6 sampled lines SHOW3: Samples collected in the function's body { SHOW3: 4: 534 @@ -36,23 +36,23 @@ SHOW3: 5.11521: 2150 SHOW3: } 4- Merge command and keep all the discrimiantor bits -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass PassLast --binary -o - | llvm-profdata show --sample - -o %t1-binary_1 -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2 -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs -o %t1-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass PassLast --binary -o - | llvm-profdata show --sample - -o %t1-binary_1 +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --binary -o - | llvm-profdata show --sample - -o %t1-binary_2 +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -o %t1-text RUN: diff %t1-binary_1 %t1-text RUN: diff %t1-binary_2 %t1-text 2- Merge command and keep only the base discriminator bits -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base --binary -o - | llvm-profdata show --sample - -o %t2-binary -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Base -o %t2-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Base -binary -o - | llvm-profdata show --sample - -o %t2-binary +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Base -o %t2-text RUN: diff %t2-binary %t2-text 3- Merge command and keep only the base discriminator bits and first pass of FS discriminator -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 --binary -o - | llvm-profdata show --sample - -o %t3-binary -RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext --profile-isfs --fs-discriminator-pass Pass1 -o %t3-text +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Pass1 -binary -o - | llvm-profdata show --sample - -o %t3-binary +RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass Pass1 -o %t3-text RUN: diff %t3-binary %t3-text 4- ProfileIsFS is set properly in extbinary format from the internal option -RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext --profile-isfs --extbinary -o %t_extbin.afdo +RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --extbinary -o %t_extbin.afdo RUN: llvm-profdata show --sample --show-sec-info-only %t_extbin.afdo | FileCheck %s --check-prefix=ISFSSET ISFSSET: Flags: {fs-discriminator} diff --git a/llvm/test/tools/llvm-profdata/sample-hot-func-list.test b/llvm/test/tools/llvm-profdata/sample-hot-func-list.test index 402923fce07b2..e66e7db8bc1d8 100644 --- a/llvm/test/tools/llvm-profdata/sample-hot-func-list.test +++ b/llvm/test/tools/llvm-profdata/sample-hot-func-list.test @@ -29,7 +29,7 @@ ; TOPN-NEXT: 184019 (51.69%) 2300 534 main ; TOPN-NEXT: 97401 (27.36%) 10640 3035 Func3 -; RUN: llvm-profdata show --sample --topn 1 %S/Inputs/cs-sample.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CS-TOPN +; RUN: llvm-profdata show -sample --topn 1 %S/Inputs/cs-sample.proftext | FileCheck %s --match-full-lines --strict-whitespace --check-prefix=CS-TOPN ; CS-TOPN:2 out of 8 functions with profile (25.00%) are considered hot functions (max sample >= 23324). ; CS-TOPN-NEXT:1968152 out of 1968919 profile counts (99.96%) are from hot functions. diff --git a/llvm/test/tools/llvm-profdata/sample-remap.test b/llvm/test/tools/llvm-profdata/sample-remap.test index a7098738695bd..8e69c45726635 100644 --- a/llvm/test/tools/llvm-profdata/sample-remap.test +++ b/llvm/test/tools/llvm-profdata/sample-remap.test @@ -1,2 +1,2 @@ -; RUN: llvm-profdata merge --sample --text %S/Inputs/sample-remap.proftext -r %S/Inputs/sample-remap.remap -o %t.output +; RUN: llvm-profdata merge -sample -text %S/Inputs/sample-remap.proftext -r %S/Inputs/sample-remap.remap -o %t.output ; RUN: diff -b %S/Inputs/sample-remap.expected %t.output diff --git a/llvm/test/tools/llvm-profdata/sample-summary.test b/llvm/test/tools/llvm-profdata/sample-summary.test index 9c1473b96b814..310cc8bfb721c 100644 --- a/llvm/test/tools/llvm-profdata/sample-summary.test +++ b/llvm/test/tools/llvm-profdata/sample-summary.test @@ -1,4 +1,4 @@ -; RUN: llvm-profdata show --sample --detailed-summary %S/Inputs/sample-profile.proftext | FileCheck %s +; RUN: llvm-profdata show -sample -detailed-summary %S/Inputs/sample-profile.proftext | FileCheck %s ; CHECK: Total functions: 3 ; CHECK-NEXT: Maximum function count: 1437 diff --git a/llvm/test/tools/llvm-profdata/show-prof-info.test b/llvm/test/tools/llvm-profdata/show-prof-info.test index 13eaf7d26e423..24b919feb9362 100644 --- a/llvm/test/tools/llvm-profdata/show-prof-info.test +++ b/llvm/test/tools/llvm-profdata/show-prof-info.test @@ -1,7 +1,7 @@ REQUIRES: zlib -; 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: 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: llvm-profdata show -sample -show-sec-info-only %t.1.output >> %t.txt ; RUN: FileCheck %s --input-file=%t.txt ; CHECK: [[FILESIZE:.*]] ; To check llvm-profdata shows the correct flags for ProfileSummarySection. diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test index 982887d213ea4..001a87a44ee19 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-flatten.test @@ -3,9 +3,9 @@ with flattening. Test bar.cc:bar's counters will be set to PseudoHot. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/flatten_sample.proftext \ +RUN: -supplement-instr-with-sample %p/Inputs/flatten_sample.proftext \ RUN: %p/Inputs/flatten_instr.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=FLATTEN +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FLATTEN FLATTEN: foo: FLATTEN-NEXT: Hash: 0x0000000000000457 diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test index 9bca631bb70f2..dc043f4d1fadb 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample-static-func.test @@ -1,16 +1,16 @@ Some basic tests for supplementing instrumentation profile with sample profile for static funcs. -RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t1 -RUN: llvm-profdata show --function foo --counts %t1 | FileCheck %s +RUN: llvm-profdata merge -supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext -suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t1 +RUN: llvm-profdata show -function foo -counts %t1 | FileCheck %s -RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/FUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t2 -RUN: llvm-profdata show --function foo --counts %t2 | FileCheck %s +RUN: llvm-profdata merge -supplement-instr-with-sample %p/Inputs/FUnique.afdotext -suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t2 +RUN: llvm-profdata show -function foo -counts %t2 | FileCheck %s -RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t3 -RUN: llvm-profdata show --function foo --counts %t3 | FileCheck %s +RUN: llvm-profdata merge -supplement-instr-with-sample %p/Inputs/NoFUnique.afdotext -suppl-min-size-threshold 2 %p/Inputs/FUnique.proftext -o %t3 +RUN: llvm-profdata show -function foo -counts %t3 | FileCheck %s -RUN: llvm-profdata merge --supplement-instr-with-sample %p/Inputs/FUnique.afdotext --suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t4 -RUN: llvm-profdata show --function foo --counts %t4 | FileCheck %s +RUN: llvm-profdata merge -supplement-instr-with-sample %p/Inputs/FUnique.afdotext -suppl-min-size-threshold 2 %p/Inputs/NoFUnique.proftext -o %t4 +RUN: llvm-profdata show -function foo -counts %t4 | FileCheck %s CHECK: Counters: 3 CHECK-NEXT: Instrumentation level: diff --git a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test index 291e0114a0eca..85a55bc879338 100644 --- a/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test +++ b/llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test @@ -2,9 +2,9 @@ Some basic tests for supplementing instrumentation profile with sample profile. Test all of goo's counters will be set to PseudoHot. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ -RUN: --suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX1 +RUN: -supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: -suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX1 MIX1: foo: MIX1-NEXT: Hash: 0x0000000000000007 @@ -22,10 +22,10 @@ MIX1-NEXT: Block counts: [3000, 1000, 2000, 500] Test when the zero counter ratio of foo is higher than zero-counter-threshold. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ -RUN: --suppl-min-size-threshold 0 --zero-counter-threshold 0.5 \ -RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX2 +RUN: -supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: -suppl-min-size-threshold 0 -zero-counter-threshold 0.5 \ +RUN: -instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX2 MIX2: foo: MIX2-NEXT: Hash: 0x0000000000000007 @@ -44,10 +44,10 @@ MIX2-NEXT: Block counts: [3000, 1000, 2000, 500] Test when the zero counter ratio of foo is lower than zero-counter-threshold. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ -RUN: --suppl-min-size-threshold 0 --zero-counter-threshold 0.7 \ -RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX3 +RUN: -supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: -suppl-min-size-threshold 0 -zero-counter-threshold 0.7 \ +RUN: -instr-prof-cold-threshold 30 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX3 MIX3: foo: MIX3-NEXT: Hash: 0x0000000000000007 @@ -66,10 +66,10 @@ MIX3-NEXT: Block counts: [3000, 1000, 2000, 500] Test foo's profile won't be adjusted because its size is smaller than suppl-min-size-threshold. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ -RUN: --suppl-min-size-threshold 2 --zero-counter-threshold 0.7 \ -RUN: --instr-prof-cold-threshold 30 %p/Inputs/mix_instr_small.proftext -o %t -RUN: llvm-profdata show %t --all-functions --counts | FileCheck %s --check-prefix=MIX4 +RUN: -supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: -suppl-min-size-threshold 2 -zero-counter-threshold 0.7 \ +RUN: -instr-prof-cold-threshold 30 %p/Inputs/mix_instr_small.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=MIX4 MIX4: foo: MIX4-NEXT: Hash: 0x0000000000000007 @@ -87,9 +87,9 @@ MIX4-NEXT: Block counts: [0] Test profile summary won't be affected by pseudo counters. RUN: llvm-profdata merge \ -RUN: --supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ -RUN: --suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t -RUN: llvm-profdata show %t --detailed-summary | FileCheck %s --check-prefix=MIX5 +RUN: -supplement-instr-with-sample %p/Inputs/mix_sample.proftext \ +RUN: -suppl-min-size-threshold 0 %p/Inputs/mix_instr.proftext -o %t +RUN: llvm-profdata show %t -detailed-summary | FileCheck %s --check-prefix=MIX5 MIX5: Instrumentation level: IR MIX5-NEXT: Total functions: 2 diff --git a/llvm/test/tools/llvm-profdata/text-dump.test b/llvm/test/tools/llvm-profdata/text-dump.test index e11e05e356ce6..22acb6e23039a 100644 --- a/llvm/test/tools/llvm-profdata/text-dump.test +++ b/llvm/test/tools/llvm-profdata/text-dump.test @@ -1,20 +1,20 @@ Basic tests for testing text dump functions. -RUN: llvm-profdata show --all-functions --counts --text %p/Inputs/basic.proftext > %t-basic.proftext1 +RUN: llvm-profdata show --all-functions -counts --text %p/Inputs/basic.proftext > %t-basic.proftext1 RUN: llvm-profdata merge -o %t-basic.proftext2 --text %p/Inputs/basic.proftext RUN: llvm-profdata merge --text %p/Inputs/basic.proftext | diff %t-basic.proftext2 - -RUN: llvm-profdata merge --binary -o %t-basic.profdata1 %t-basic.proftext1 +RUN: llvm-profdata merge -binary -o %t-basic.profdata1 %t-basic.proftext1 RUN: llvm-profdata merge -o %t-basic.profdata2 %t-basic.proftext2 -RUN: llvm-profdata show --all-functions --counts %t-basic.profdata1 > %t-basic.dump3 -RUN: llvm-profdata show --all-functions --counts %t-basic.profdata2 > %t-basic.dump4 +RUN: llvm-profdata show --all-functions -counts %t-basic.profdata1 > %t-basic.dump3 +RUN: llvm-profdata show --all-functions -counts %t-basic.profdata2 > %t-basic.dump4 -RUN: llvm-profdata merge --text -o %t-basic.proftext5 %t-basic.profdata1 -RUN: llvm-profdata merge --text -o %t-basic.proftext6 %t-basic.profdata2 +RUN: llvm-profdata merge -text -o %t-basic.proftext5 %t-basic.profdata1 +RUN: llvm-profdata merge -text -o %t-basic.proftext6 %t-basic.profdata2 RUN: diff %t-basic.dump3 %t-basic.dump4 RUN: diff %t-basic.proftext5 %t-basic.proftext6 -RUN: not llvm-profdata merge --gcc -o %t-basic-profdata3 %t-basic.proftext2 2>&1 | FileCheck %s --check-prefix=UNKNOWN +RUN: not llvm-profdata merge -gcc -o %t-basic-profdata3 %t-basic.proftext2 2>&1 | FileCheck %s --check-prefix=UNKNOWN UNKNOWN: unknown format is specified diff --git a/llvm/test/tools/llvm-profdata/text-format-errors.test b/llvm/test/tools/llvm-profdata/text-format-errors.test index 309d14ffb6be9..b5bda920c4857 100644 --- a/llvm/test/tools/llvm-profdata/text-format-errors.test +++ b/llvm/test/tools/llvm-profdata/text-format-errors.test @@ -5,7 +5,7 @@ RUN: not llvm-profdata show %p/Inputs/invalid-count-later.proftext 2>&1 | FileCh INVALID-COUNT-LATER-SHOW: error: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data RUN: not llvm-profdata merge %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE -RUN: not llvm-profdata merge --failure-mode all %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE +RUN: not llvm-profdata merge -failure-mode all %p/Inputs/invalid-count-later.proftext %p/Inputs/invalid-count-later.proftext -o %t.out 2>&1 | FileCheck %s --check-prefix=INVALID-COUNT-LATER-MERGE INVALID-COUNT-LATER-MERGE: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data INVALID-COUNT-LATER-MERGE-NEXT: warning: {{.*}}invalid-count-later.proftext: malformed instrumentation profile data INVALID-COUNT-LATER-MERGE-NEXT: error: no profile can be merged diff --git a/llvm/test/tools/llvm-profdata/value-prof.proftext b/llvm/test/tools/llvm-profdata/value-prof.proftext index a6bfff56c9e28..ec09e40e496d7 100644 --- a/llvm/test/tools/llvm-profdata/value-prof.proftext +++ b/llvm/test/tools/llvm-profdata/value-prof.proftext @@ -1,7 +1,7 @@ -# RUN: llvm-profdata show --ic-targets --all-functions %s | FileCheck %s --check-prefixes=ICTXT,ICSUM -# RUN: llvm-profdata show --ic-targets --counts --text --all-functions %s | FileCheck %s --check-prefix=ICTEXT +# RUN: llvm-profdata show -ic-targets -all-functions %s | FileCheck %s --check-prefixes=ICTXT,ICSUM +# RUN: llvm-profdata show -ic-targets -counts -text -all-functions %s | FileCheck %s --check-prefix=ICTEXT # RUN: llvm-profdata merge -o %t.profdata %s -# RUN: llvm-profdata show --ic-targets --all-functions %t.profdata | FileCheck %s --check-prefixes=IC,ICSUM +# RUN: llvm-profdata show -ic-targets -all-functions %t.profdata | FileCheck %s --check-prefixes=IC,ICSUM foo # Func Hash: diff --git a/llvm/test/tools/llvm-profdata/weight-instr.test b/llvm/test/tools/llvm-profdata/weight-instr.test index c42ba179424b9..92fb83838b2fe 100644 --- a/llvm/test/tools/llvm-profdata/weight-instr.test +++ b/llvm/test/tools/llvm-profdata/weight-instr.test @@ -1,14 +1,14 @@ Tests for weighted merge of instrumented profiles. 1- Merge the foo and bar profiles with unity weight and verify the combined output -RUN: llvm-profdata merge --instr --weighted-input 1,%p/Inputs/weight-instr-bar.profdata --weighted-input 1,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show --instr --all-functions %t > %t.out1 +RUN: llvm-profdata merge -instr -weighted-input 1,%p/Inputs/weight-instr-bar.profdata -weighted-input 1,%p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show -instr -all-functions %t > %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-1 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-2 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-3 < %t.out1 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-4 < %t.out1 -RUN: llvm-profdata merge --instr --weighted-input 1,%p/Inputs/weight-instr-bar.profdata %p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show --instr --all-functions %t > %t.out2 +RUN: llvm-profdata merge -instr -weighted-input 1,%p/Inputs/weight-instr-bar.profdata %p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show -instr -all-functions %t > %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-1 < %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-2 < %t.out2 RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-3 < %t.out2 @@ -36,8 +36,8 @@ RUN: FileCheck %s -check-prefixes=1X_1X_WEIGHT,1X_1X_WEIGHT-4 < %t.out2 1X_1X_WEIGHT-NEXT: Maximum internal block count: 267914296 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output -RUN: llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 5,%p/Inputs/weight-instr-foo.profdata -o %t -RUN: llvm-profdata show --instr --all-functions %t > %t.out3 +RUN: llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input 5,%p/Inputs/weight-instr-foo.profdata -o %t +RUN: llvm-profdata show -instr -all-functions %t > %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-1 < %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-2 < %t.out3 RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-3 < %t.out3 @@ -65,17 +65,17 @@ RUN: FileCheck %s -check-prefixes=3X_5X_WEIGHT,3X_5X_WEIGHT-4 < %t.out3 3X_5X_WEIGHT-NEXT: Maximum internal block count: 1339571480 3- Bad merge: invalid weight -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 0,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input 0.75,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input -5,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input ,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/weight-instr-bar.profdata --weighted-input %p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input 0,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input 0.75,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input -5,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input ,%p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/weight-instr-bar.profdata -weighted-input %p/Inputs/weight-instr-foo.profdata -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT INVALID_WEIGHT: error: input weight must be a positive integer 4- Bad merge: input path does not exist -RUN: not llvm-profdata merge --instr --weighted-input 3,%p/Inputs/does-not-exist.profdata --weighted-input 2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT +RUN: not llvm-profdata merge -instr -weighted-input 3,%p/Inputs/does-not-exist.profdata -weighted-input 2,%p/Inputs/does-not-exist-either.profdata -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.profdata: [[MSG]] 5- No inputs -RUN: not llvm-profdata merge --instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT -NO_INPUT: error: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge --help +RUN: not llvm-profdata merge -instr -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT +NO_INPUT: error: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help diff --git a/llvm/test/tools/llvm-profdata/weight-sample.test b/llvm/test/tools/llvm-profdata/weight-sample.test index 3f7f6b401ba21..e5d74c372af10 100644 --- a/llvm/test/tools/llvm-profdata/weight-sample.test +++ b/llvm/test/tools/llvm-profdata/weight-sample.test @@ -1,8 +1,8 @@ Tests for weighted merge of sample profiles. 1- Merge the foo and bar profiles with unity weight and verify the combined output -RUN: llvm-profdata merge --sample --text --weighted-input 1,%p/Inputs/weight-sample-bar.proftext --weighted-input 1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT -RUN: llvm-profdata merge --sample --text --weighted-input 1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata merge -sample -text -weighted-input 1,%p/Inputs/weight-sample-bar.proftext -weighted-input 1,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT +RUN: llvm-profdata merge -sample -text -weighted-input 1,%p/Inputs/weight-sample-bar.proftext %p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=1X_1X_WEIGHT 1X_1X_WEIGHT-DAG: foo:1763288:35327 1X_1X_WEIGHT-DAG: 7: 35327 1X_1X_WEIGHT-DAG: 8: 35327 @@ -21,7 +21,7 @@ RUN: llvm-profdata merge --sample --text --weighted-input 1,%p/Inputs/weight-sam 1X_1X_WEIGHT-DAG: 25: 36666 2- Merge the foo and bar profiles with weight 3x and 5x respectively and verify the combined output -RUN: llvm-profdata merge --sample --text --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT +RUN: llvm-profdata merge -sample -text -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input 5,%p/Inputs/weight-sample-foo.proftext -o - | FileCheck %s -check-prefix=3X_5X_WEIGHT 3X_5X_WEIGHT-DAG: foo:8816440:176635 3X_5X_WEIGHT-DAG: 7: 176635 3X_5X_WEIGHT-DAG: 8: 176635 @@ -40,17 +40,17 @@ RUN: llvm-profdata merge --sample --text --weighted-input 3,%p/Inputs/weight-sam 3X_5X_WEIGHT-DAG: 25: 109998 3- Bad merge: invalid weight -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input 0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input -5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input ,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/weight-sample-bar.proftext --weighted-input %p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input 0,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input 0.75,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input -5,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input ,%p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/weight-sample-bar.proftext -weighted-input %p/Inputs/weight-sample-foo.proftext -o %t.out 2>&1 | FileCheck %s -check-prefix=INVALID_WEIGHT INVALID_WEIGHT: error: input weight must be a positive integer 4- Bad merge: input path does not exist -RUN: not llvm-profdata merge --sample --weighted-input 3,%p/Inputs/does-not-exist.proftext --weighted-input 2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT +RUN: not llvm-profdata merge -sample -weighted-input 3,%p/Inputs/does-not-exist.proftext -weighted-input 2,%p/Inputs/does-not-exist-either.proftext -o %t.out 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix=INVALID_INPUT INVALID_INPUT: {{.*}}: {{.*}}does-not-exist.proftext: [[MSG]] 5- No inputs -RUN: not llvm-profdata merge --sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT -NO_INPUT: {{.*}}: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge --help +RUN: not llvm-profdata merge -sample -o %t.out 2>&1 | FileCheck %s -check-prefix=NO_INPUT +NO_INPUT: {{.*}}: no input files specified. See llvm-profdata{{(\.EXE|\.exe)?}} merge -help diff --git a/llvm/test/tools/llvm-profgen/cs-preinline.test b/llvm/test/tools/llvm-profgen/cs-preinline.test index c6f6d1d3fedc2..b48d63cf75b77 100644 --- a/llvm/test/tools/llvm-profgen/cs-preinline.test +++ b/llvm/test/tools/llvm-profgen/cs-preinline.test @@ -21,15 +21,15 @@ ; Test preInlined flat is set for extbinary profiles with preinliner on. ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --gen-cs-nested-profile=0 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t2.prof -; RUN: llvm-profdata show --sample --show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --csspgo-preinliner=1 --sample-profile-hot-inline-threshold=3000 --sample-profile-cold-inline-threshold=45 --output=%t5.prof --gen-cs-nested-profile=1 -; RUN: llvm-profdata show --sample --show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; Test preInlined flat is set when converted from a text profile that has "ShouldInline" contexts. ; RUN: llvm-profdata merge --sample %t2 -o %t2.prof --extbinary -; RUN: llvm-profdata show --sample --show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample -show-sec-info-only %t2.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; RUN: llvm-profdata merge --sample %t5 -o %t5.prof --extbinary -; RUN: llvm-profdata show --sample --show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG +; RUN: llvm-profdata show --sample -show-sec-info-only %t5.prof | FileCheck %s -check-prefix=CHECK-PREINL-FLAG ; CHECK-DEFAULT: [main:1 @ foo]:309:0 diff --git a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test index a2805f98ab5f2..5f8d89f7ba8e7 100644 --- a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test +++ b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test @@ -6,7 +6,7 @@ ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-STRIP-CTX ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-cs-noprobe.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --profile-summary-cold-count=0 --populate-profile-symbol-list=1 --csspgo-preinliner=0 --gen-cs-nested-profile=0 -; RUN: llvm-profdata show --show-prof-sym-list --sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST +; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST ; CHECK-SYM-LIST: Dump profile symbol list ; CHECK-SYM-LIST: bar diff --git a/llvm/test/tools/llvm-profgen/inline-noprobe2.test b/llvm/test/tools/llvm-profgen/inline-noprobe2.test index ab696dd13162e..e19d991f0f1c4 100644 --- a/llvm/test/tools/llvm-profgen/inline-noprobe2.test +++ b/llvm/test/tools/llvm-profgen/inline-noprobe2.test @@ -6,7 +6,7 @@ ; RUN: FileCheck %s --input-file %t1 --check-prefix=CHECK ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/inline-noprobe2.perfscript --binary=%S/Inputs/inline-noprobe2.perfbin --output=%t --populate-profile-symbol-list=1 -; RUN: llvm-profdata show --show-prof-sym-list --sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST +; RUN: llvm-profdata show -show-prof-sym-list -sample %t | FileCheck %s --check-prefix=CHECK-SYM-LIST ; CHECK-EXT-ADDR: 2 ; CHECK-EXT-ADDR-NEXT: 400870-400870:2 diff --git a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test index 80ac402c1b20d..d95870eb3dd30 100644 --- a/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test +++ b/llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test @@ -13,9 +13,9 @@ ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/noinline-cs-noprobe.perfscript --binary=%S/Inputs/noinline-cs-noprobe.perfbin --output=%t1 --profile-summary-cold-count=0 ; RUN: llvm-profgen --format=extbinary --perfscript=%S/Inputs/noinline-cs-noprobe.perfscript --binary=%S/Inputs/noinline-cs-noprobe.perfbin --output=%t2 --profile-summary-cold-count=0 -use-md5 -; RUN: llvm-profdata show --sample --show-sec-info-only %t2 | FileCheck %s --check-prefix=CHECK-MD5 -; RUN: llvm-profdata show --sample --detailed-summary --function dummy %t1 > %t.summary -; RUN: llvm-profdata show --sample --detailed-summary --function dummy %t2 > %t2.summary +; RUN: llvm-profdata show --sample -show-sec-info-only %t2 | FileCheck %s --check-prefix=CHECK-MD5 +; RUN: llvm-profdata show --sample -detailed-summary --function dummy %t1 > %t.summary +; RUN: llvm-profdata show --sample -detailed-summary --function dummy %t2 > %t2.summary ; RUN: diff -b %t.summary %t2.summary diff --git a/llvm/tools/llvm-profdata/Opts.td b/llvm/tools/llvm-profdata/Opts.td index 038200f910e61..ef49e1aa31d61 100644 --- a/llvm/tools/llvm-profdata/Opts.td +++ b/llvm/tools/llvm-profdata/Opts.td @@ -25,16 +25,16 @@ def Merge : SubCommand<"merge", def help : Flag<["--"], "help">, HelpText<"Display this help">; def version : Flag<["--"], "version">, HelpText<"Display the version">; -def output : JoinedOrSeparate<["--"], "output", +def output : JoinedOrSeparate<["-", "--"], "output", [Show, Order, Overlap, Merge]>, MetaVarName<"">, HelpText<"Output file">; def : JoinedOrSeparate<["-"], "o", [Show, Order, Overlap, Merge]>, Alias, HelpText<"Alias for --output">; -def instr : Flag<["--"], "instr", [Show, Overlap, Merge]>, +def instr : Flag<["-", "--"], "instr", [Show, Overlap, Merge]>, HelpText<"Instrumentation profile (default)">; -def sample : Flag<["--"], "sample", [Show, Overlap, Merge]>, +def sample : Flag<["-", "--"], "sample", [Show, Overlap, Merge]>, HelpText<"Sample profile">; def memory : Flag<["--"], "memory", [Show]>, HelpText<"MemProf memory access profile">; @@ -72,31 +72,31 @@ def correlate : JoinedOrSeparate<["--"], "correlate", HelpText<"Use debug-info or binary correlation to correlate " "profiles with build id fetcher">, MetaVarName<"">; -def function : JoinedOrSeparate<["--"], "function", +def function : JoinedOrSeparate<["-", "--"], "function", [Show, Overlap, Merge]>, HelpText<"Only functions matching the filter are shown or " "merged.">, MetaVarName<"">; def weighted_input - : JoinedOrSeparate<["--"], "weighted-input", [Merge]>, + : JoinedOrSeparate<["-", "--"], "weighted-input", [Merge]>, HelpText<",">, MetaVarName<",">; -def binary : Flag<["--"], "binary", [Merge]>, +def binary : Flag<["-", "--"], "binary", [Merge]>, HelpText<"Binary encoding">; -def extbinary : Flag<["--"], "extbinary", [Merge]>, +def extbinary : Flag<["-", "--"], "extbinary", [Merge]>, HelpText<"Extensible binary encoding (default)">; -def text : Flag<["--"], "text", [Show, Merge]>, +def text : Flag<["-", "--"], "text", [Show, Merge]>, HelpText<"Text output format">; -def gcc : Flag<["--"], "gcc", [Merge]>, +def gcc : Flag<["-", "--"], "gcc", [Merge]>, HelpText<"GCC encoding (only meaningful for -sample)">; def input_files - : JoinedOrSeparate<["--"], "input-files", [Merge]>, + : JoinedOrSeparate<["-", "--"], "input-files", [Merge]>, HelpText<"Path to file containing newline-separated " "[,] entries">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "f", [Merge]>, Alias, HelpText<"Alias for --input-files">; -def dump_input_file_list : Flag<["--"], "dump-input-file-list", [Merge]>, +def dump_input_file_list : Flag<["-", "--"], "dump-input-file-list", [Merge]>, HelpText<"Dump the list of input files and their " "weights, then exit">; @@ -105,22 +105,22 @@ def remapping_file HelpText<"Symbol remapping file">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "r", [Merge]>, Alias, HelpText<"Alias for --remapping-file">; -def use_md5 : Flag<["--"], "use-md5", [Merge]>, +def use_md5 : Flag<["-", "--"], "use-md5", [Merge]>, HelpText<"Use MD5 to represent strings in the name table " "(only meaningful for -extbinary)">; def compress_all_sections - : Flag<["--"], "compress-all-sections", [Merge]>, + : Flag<["-", "--"], "compress-all-sections", [Merge]>, HelpText<"Compress all sections when writing the profile (only " "meaningful for -extbinary)">; def sample_merge_cold_context - : Flag<["--"], "sample-merge-cold-context", [Merge]>, + : Flag<["-", "--"], "sample-merge-cold-context", [Merge]>, HelpText<"Merge context sample profiles whose count is below cold " "threshold">; def sample_trim_cold_context - : Flag<["--"], "sample-trim-cold-context", [Merge]>, + : Flag<["-", "--"], "sample-trim-cold-context", [Merge]>, HelpText<"Trim context sample profiles whose count is below cold " "threshold">; @@ -136,7 +136,7 @@ def output_size_limit "limit in bytes">, MetaVarName<"">; def gen_partial_profile - : Flag<["--"], "gen-partial-profile", [Merge]>, + : Flag<["-", "--"], "gen-partial-profile", [Merge]>, HelpText<"Generate a partial profile (only meaningful for -extbinary)">; def split_layout : Flag<["--"], "split-layout", [Merge]>, @@ -145,22 +145,22 @@ def split_layout : Flag<["--"], "split-layout", [Merge]>, "-extbinary)">; def supplement_instr_with_sample - : JoinedOrSeparate<["--"], "supplement-instr-with-sample", [Merge]>, + : JoinedOrSeparate<["-", "--"], "supplement-instr-with-sample", [Merge]>, HelpText<"Supplement an instr profile with a sample profile. Output " "will be in instr format.">, MetaVarName<"">; def zero_counter_threshold - : JoinedOrSeparate<["--"], "zero-counter-threshold", [Merge]>, + : JoinedOrSeparate<["-", "--"], "zero-counter-threshold", [Merge]>, HelpText<"Ratio of zero counters required to drop a function when " "supplementing instr profiles">, MetaVarName<"">; def suppl_min_size_threshold - : JoinedOrSeparate<["--"], "suppl-min-size-threshold", [Merge]>, + : JoinedOrSeparate<["-", "--"], "suppl-min-size-threshold", [Merge]>, HelpText<"Assume functions smaller than this threshold can be inlined " "and will not be adjusted based on sample profile.">, MetaVarName<"">; def instr_prof_cold_threshold - : JoinedOrSeparate<["--"], "instr-prof-cold-threshold", [Merge]>, + : JoinedOrSeparate<["-", "--"], "instr-prof-cold-threshold", [Merge]>, HelpText<"User specified cold threshold for instr profile to override " "the cold threshold from profile summary.">, MetaVarName<"">; @@ -181,19 +181,19 @@ def no_function : JoinedOrSeparate<["--"], "no-function", [Merge]>, "output.">, MetaVarName<"">; def failure_mode - : JoinedOrSeparate<["--"], "failure-mode", [Merge]>, + : JoinedOrSeparate<["-", "--"], "failure-mode", [Merge]>, HelpText<"Failure mode: warn, any, or all">, MetaVarName<"">; def sparse - : Flag<["--"], "sparse", [Merge]>, + : Flag<["-", "--"], "sparse", [Merge]>, HelpText<"Generate a sparse profile (only meaningful for -instr)">; -def profile_isfs : Flag<["--"], "profile-isfs", [Show, Merge]>, +def profile_isfs : Flag<["-", "--"], "profile-isfs", [Show, Merge]>, HelpText<"Profile uses flow-sensitive discriminators">; def generate_merged_base_profiles - : Flag<["--"], "generate-merged-base-profiles", [Merge]>, + : Flag<["-", "--"], "generate-merged-base-profiles", [Merge]>, HelpText<"Generate merged base profiles when creating nested " "context-sensitive profiles">; @@ -208,7 +208,7 @@ def profile_summary_cutoff_hot HelpText<"Percentile (times 10000) for determining hot threshold">; def profile_summary_cutoff_cold - : JoinedOrSeparate<["--"], "profile-summary-cutoff-cold", + : JoinedOrSeparate<["-", "--"], "profile-summary-cutoff-cold", [Show, Merge]>, HelpText<"Percentile (times 10000) for determining cold threshold">; @@ -218,7 +218,7 @@ def profile_summary_hot_count HelpText<"Override hot count derived from summary cutoffs">; def profile_summary_cold_count - : JoinedOrSeparate<["--"], "profile-summary-cold-count", + : JoinedOrSeparate<["-", "--"], "profile-summary-cold-count", [Show, Merge]>, HelpText<"Override cold count derived from summary cutoffs">; @@ -239,13 +239,13 @@ def profile_summary_large_working_set_size_threshold [Show, Merge]>, HelpText<"Threshold for large working set size used in profile summary">; -def num_threads : JoinedOrSeparate<["--"], "num-threads", [Merge]>, +def num_threads : JoinedOrSeparate<["-", "--"], "num-threads", [Merge]>, HelpText<"Number of merge threads to use (default: autodetect)">, MetaVarName<"">; def : JoinedOrSeparate<["-"], "j", [Merge]>, Alias, HelpText<"Alias for --num-threads">; def prof_sym_list - : JoinedOrSeparate<["--"], "prof-sym-list", [Merge]>, + : JoinedOrSeparate<["-", "--"], "prof-sym-list", [Merge]>, HelpText<"Path to file containing the list of function symbols used to " "populate profile symbol list">, MetaVarName<"">; @@ -276,11 +276,11 @@ def memprof_full_schema HelpText<"Use the full schema for serialization">; def memprof_random_hotness - : Flag<["--"], "memprof-random-hotness", [Merge]>, + : Flag<["-", "--"], "memprof-random-hotness", [Merge]>, HelpText<"Generate random hotness values">; def memprof_random_hotness_seed - : JoinedOrSeparate<["--"], "memprof-random-hotness-seed", [Merge]>, + : JoinedOrSeparate<["-", "--"], "memprof-random-hotness-seed", [Merge]>, HelpText<"Random hotness seed to use (0 to generate new seed)">, MetaVarName<"">; @@ -289,15 +289,15 @@ def similarity_cutoff HelpText<"List overlapped functions with similarities below the cutoff " "(percentage times 10000).">, MetaVarName<"">; -def cs : Flag<["--"], "cs", [Overlap]>, +def cs : Flag<["-", "--"], "cs", [Overlap]>, HelpText<"For context sensitive PGO counts. Does not work with " "CSSPGO.">; def value_cutoff - : JoinedOrSeparate<["--"], "value-cutoff", [Show, Overlap]>, + : JoinedOrSeparate<["-", "--"], "value-cutoff", [Show, Overlap]>, HelpText<"Cutoff value used for filtering. Meaning depends on subcommand">, MetaVarName<"">; -def counts : Flag<["--"], "counts", [Show]>, +def counts : Flag<["-", "--"], "counts", [Show]>, HelpText<"Show counter values for shown functions">; def show_format : JoinedOrSeparate<["--"], "show-format", [Show]>, @@ -306,17 +306,17 @@ def show_format def json : Flag<["--"], "json", [Show]>, HelpText<"Show sample profile data in JSON format " "(deprecated, use --show-format=json)">; -def ic_targets : Flag<["--"], "ic-targets", [Show]>, +def ic_targets : Flag<["-", "--"], "ic-targets", [Show]>, HelpText<"Show indirect call site target values">; def show_vtables : Flag<["--"], "show-vtables", [Show]>, HelpText<"Show vtable names for shown functions">; def extbinary_write_vtable_type_prof - : Flag<["--"], "extbinary-write-vtable-type-prof", [Merge]>, + : Flag<["-", "--"], "extbinary-write-vtable-type-prof", [Merge]>, HelpText<"Include vtable type profile data in ext-binary sample profile">; -def memop_sizes : Flag<["--"], "memop-sizes", [Show]>, +def memop_sizes : Flag<["-", "--"], "memop-sizes", [Show]>, HelpText<"Show profiled sizes of memory intrinsic calls">; -def detailed_summary : Flag<["--"], "detailed-summary", [Show]>, +def detailed_summary : Flag<["-", "--"], "detailed-summary", [Show]>, HelpText<"Show detailed profile summary">; def detailed_summary_cutoffs : JoinedOrSeparate<["--"], "detailed-summary-cutoffs", [Show]>, @@ -325,22 +325,22 @@ def detailed_summary_cutoffs MetaVarName<"">; def hot_func_list : Flag<["--"], "hot-func-list", [Show]>, HelpText<"Show profile summary of a list of hot functions">; -def all_functions : Flag<["--"], "all-functions", [Show]>, +def all_functions : Flag<["-", "--"], "all-functions", [Show]>, HelpText<"Details for each and every function">; -def showcs : Flag<["--"], "showcs", [Show]>, +def showcs : Flag<["-", "--"], "showcs", [Show]>, HelpText<"Show context sensitive counts">; def topn : JoinedOrSeparate<["--"], "topn", [Show]>, HelpText<"Show the list of functions with the largest internal counts">, MetaVarName<"">; def list_below_cutoff - : Flag<["--"], "list-below-cutoff", [Show]>, + : Flag<["-", "--"], "list-below-cutoff", [Show]>, HelpText<"Only output names of functions whose max count values are " "below the cutoff value">; def show_prof_sym_list - : Flag<["--"], "show-prof-sym-list", [Show]>, + : Flag<["-", "--"], "show-prof-sym-list", [Show]>, HelpText<"Show profile symbol list if it exists in the profile.">; def show_sec_info_only - : Flag<["--"], "show-sec-info-only", [Show]>, + : Flag<["-", "--"], "show-sec-info-only", [Show]>, HelpText<"Show the information of each section in the sample profile " "(extbinary sample profiles only)">; def binary_ids : Flag<["--"], "binary-ids", [Show]>, @@ -360,7 +360,7 @@ def num_test_traces MetaVarName<"">; def fs_discriminator_pass - : Joined<["--"], "fs-discriminator-pass=", [Show, Overlap, Merge]>, + : Joined<["-", "--"], "fs-discriminator-pass=", [Show, Overlap, Merge]>, Values<"base,pass1,pass2,pass3,passlast">, HelpText<"Zero out the discriminator bits for the FS discriminator " "pass beyond this value.">;