This is an archive of the discontinued LLVM Phabricator instance.

Sanitize llvm-extract -help output
ClosedPublic

Authored by serge-sans-paille on May 28 2019, 1:24 AM.

Details

Summary

Filter out irrelevant options

New output:

OVERVIEW: llvm extractor

USAGE: llvm-extract [options] <input bitcode file>

OPTIONS:

Generic Options:

  --help              - Display available options (--help-hidden for more)
  --help-list         - Display list of available options (--help-list-hidden for more)
  --version           - Display the version of this program

llvm-extract Options:

  --alias=<alias>     - Specify alias to extract
  --bb=<function:bb>  - Specify <function, basic block> pairs to extract
  --delete            - Delete specified Globals from Module
  -f                  - Enable binary output on terminals
  --func=<function>   - Specify function to extract
  --glob=<global>     - Specify global to extract
  -o=<filename>       - Specify output filename
  --ralias=<ralias>   - Specify alias(es) to extract using a regular expression
  --recursive         - Recursively extract all called functions
  --rfunc=<rfunction> - Specify function(s) to extract using a regular expression
  --rglob=<rglobal>   - Specify global(s) to extract using a regular expression

Diff Detail

Repository
rL LLVM

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2019, 1:24 AM

For reference, the output before filtering (but after categorization)

OVERVIEW: llvm extractor

USAGE: llvm-extract [options] <input bitcode file>

OPTIONS:

Color Options:

  --color                                            - Use colors in output (default=autodetect)

General options:

  --atomic-counter-update-promoted                   - Do counter update using atomic fetch add  for promoted counters only
  --bounds-checking-single-trap                      - Use one trap block per function
  --cost-kind=<value>                                - Target cost kind
    =throughput                                      -   Reciprocal throughput
    =latency                                         -   Instruction latency
    =code-size                                       -   Code size
  --cvp-dont-add-nowrap-flags                        - 
  --do-counter-promotion                             - Do counter register promotion
  --enable-gvn-memdep                                - 
  --enable-load-pre                                  - 
  --enable-loop-simplifycfg-term-folding             - 
  --enable-name-compression                          - Enable name string compression
  --expensive-combines                               - Enable expensive instruction combines
  --hash-based-counter-split                         - Rename counter variable of a comdat function based on cfg hash
  --import-all-index                                 - Import all external functions in index.
  --instcombine-code-sinking                         - Enable code sinking
  --instcombine-guard-widening-window=<uint>         - How wide an instruction window to bypass looking for another guard
  --instcombine-max-num-phis=<uint>                  - Maximum number phis to handle in intptr/ptrint folding
  --instcombine-maxarray-size=<uint>                 - Maximum array size considered when doing a combine
  --instrprof-atomic-counter-update-all              - Make all profile counter updates atomic (for testing only)
  --internalize-public-api-file=<filename>           - A file containing list of symbol names to preserve
  --internalize-public-api-list=<list>               - A list of symbol names to preserve
  --iterative-counter-promotion                      - Allow counter promotion across the whole loop nest.
  --max-counter-promotions=<int>                     - Max number of allowed counter promotions
  --max-counter-promotions-per-loop=<uint>           - Max number counter promotions per loop to avoid increasing register pressure too much
  --memop-size-large=<uint>                          - Set large value thresthold in memory intrinsic size profiling. Value of 0 disables the large value profiling.
  --memop-size-range=<string>                        - Set the range of size in memory intrinsic calls to be profiled precisely, in a format of <start_val>:<end_val>
  --no-discriminators                                - Disable generation of discriminator information.
  --remarks-yaml-string-table                        - 
  --safepoint-ir-verifier-print-only                 - 
  --sample-profile-check-record-coverage=<N>         - Emit a warning if less than N% of records in the input profile are matched to the IR.
  --sample-profile-check-sample-coverage=<N>         - Emit a warning if less than N% of samples in the input profile are matched to the IR.
  --sample-profile-max-propagate-iterations=<uint>   - Maximum number of iterations to go through when propagating sample block/edge weights through the CFG.
  --speculative-counter-promotion-max-exiting=<uint> - The max number of exiting blocks of a loop to allow  speculative counter promotion
  --speculative-counter-promotion-to-loop            - When the option is false, if the target block is in a loop, the promotion will be disallowed unless the promoted counter  update can be further/iteratively promoted into an acyclic  region.
  --summary-file=<string>                            - The summary file to use for function importing.
  --time-trace-granularity=<uint>                    - Minimum time granularity (in microseconds) traced by time profiler
  --verify-region-info                               - Verify region info (time consuming)
  --vp-counters-per-site=<number>                    - The average number of profile counters allocated per value profiling site.
  --vp-static-alloc                                  - Do static counter allocation for value profiler

Generic Options:

  --help                                             - Display available options (--help-hidden for more)
  --help-list                                        - Display list of available options (--help-list-hidden for more)
  --version                                          - Display the version of this program

llvm-extract Options:

  --alias=<alias>                                    - Specify alias to extract
  --bb=<function:bb>                                 - Specify <function, basic block> pairs to extract
  --delete                                           - Delete specified Globals from Module
  -f                                                 - Enable binary output on terminals
  --func=<function>                                  - Specify function to extract
  --glob=<global>                                    - Specify global to extract
  -o=<filename>                                      - Specify output filename
  --ralias=<ralias>                                  - Specify alias(es) to extract using a regular expression
  --recursive                                        - Recursively extract all called functions
  --rfunc=<rfunction>                                - Specify function(s) to extract using a regular expression
  --rglob=<rglobal>                                  - Specify global(s) to extract using a regular expression

According to the callgraph, the only options reachable from main and filtered out are hidden ones related to pass debugging.

I'm not familiar at all with llvm-extract, but what you've done looks reasonable, barring one comment. Maybe worth seeing if there are others who have used/developed this tool to get a bit more confirmation.

llvm/tools/llvm-extract/llvm-extract.cpp
43 ↗(On Diff #201619)

Do you need the category here on a positional argument?

serge-sans-paille marked an inline comment as done.Jun 5 2019, 12:21 AM
serge-sans-paille added inline comments.
llvm/tools/llvm-extract/llvm-extract.cpp
43 ↗(On Diff #201619)

Definitively not!

remove category of positional argument

jhenderson accepted this revision.Jun 5 2019, 3:18 AM

Okay, LGTM. Might be worth waiting a couple of days in case somebody with more familiarity with the tool wants to chime in.

This revision is now accepted and ready to land.Jun 5 2019, 3:18 AM
This revision was automatically updated to reflect the committed changes.