summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Richardson <alexrichardson@google.com>2022-05-09 14:51:02 +0000
committerAlex Richardson <alexrichardson@google.com>2022-05-09 15:04:40 +0000
commit7c20e7ca8642bafa44f5829a14deea5f9b37f0ef (patch)
tree5a14e1656becfcbf16d4cf3c12ba1f14d09c9216
parent01188f996d2e65c9f1d0849cf834acebb32065ea (diff)
downloadllvm-7c20e7ca8642bafa44f5829a14deea5f9b37f0ef.tar.gz
[ELF] Support -plugin-opt=stats-file=
This flag is added by clang::driver::tools::addLTOOptions() and was causing errors for me when building the llvm-test-suite repository with LTO and -DTEST_SUITE_COLLECT_STATS=ON. This replaces the --stats-file= option added in 1c04b52b2594d403f739ed919ef420b1e47ae343 since the flag is only used for LTO and should therefore be in the -plugin-opt= namespace. Additionally, this commit fixes the `REQUIRES: asserts` that was added in 948d05324a150a5a24e93bad07c9090d5b8bd129: the feature was never defined in the lld test suite so it effectively disabled the test. Reviewed By: MaskRay, MTC Differential Revision: https://reviews.llvm.org/D124105
-rw-r--r--lld/ELF/Driver.cpp2
-rw-r--r--lld/ELF/Options.td4
-rw-r--r--lld/test/ELF/lto/stats-file-option.ll2
-rw-r--r--lld/test/lit.cfg.py3
4 files changed, 6 insertions, 5 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index ba24be790186..1e0a46040eb9 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1127,7 +1127,7 @@ static void readConfigs(opt::InputArgList &args) {
config->oFormatBinary = isOutputFormatBinary(args);
config->omagic = args.hasFlag(OPT_omagic, OPT_no_omagic, false);
config->optRemarksFilename = args.getLastArgValue(OPT_opt_remarks_filename);
- config->optStatsFilename = args.getLastArgValue(OPT_opt_stats_filename);
+ config->optStatsFilename = args.getLastArgValue(OPT_plugin_opt_stats_file);
// Parse remarks hotness threshold. Valid value is either integer or 'auto'.
if (auto *arg = args.getLastArg(OPT_opt_remarks_hotness_threshold)) {
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 86bd93a6e878..73e7b2dded67 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -582,8 +582,6 @@ def opt_remarks_with_hotness: FF<"opt-remarks-with-hotness">,
HelpText<"Include hotness information in the optimization remarks file">;
def opt_remarks_format: Separate<["--"], "opt-remarks-format">,
HelpText<"The format used for serializing remarks (default: YAML)">;
-def opt_stats_filename: JJ<"stats-file=">,
- HelpText<"Filename to write statistics to">;
def save_temps: F<"save-temps">, HelpText<"Save intermediate LTO compilation results">;
def lto_basic_block_sections: JJ<"lto-basic-block-sections=">,
HelpText<"Enable basic block sections for LTO">;
@@ -646,6 +644,8 @@ def: J<"plugin-opt=opt-remarks-hotness-threshold=">,
def: J<"plugin-opt=sample-profile=">,
Alias<lto_sample_profile>, HelpText<"Alias for --lto-sample-profile">;
def: F<"plugin-opt=save-temps">, Alias<save_temps>, HelpText<"Alias for --save-temps">;
+def plugin_opt_stats_file: J<"plugin-opt=stats-file=">,
+ HelpText<"Filename to write LTO statistics to">;
def: F<"plugin-opt=thinlto-emit-imports-files">,
Alias<thinlto_emit_imports_files>,
HelpText<"Alias for --thinlto-emit-imports-files">;
diff --git a/lld/test/ELF/lto/stats-file-option.ll b/lld/test/ELF/lto/stats-file-option.ll
index 36bb4a30c7f0..c83113d5e737 100644
--- a/lld/test/ELF/lto/stats-file-option.ll
+++ b/lld/test/ELF/lto/stats-file-option.ll
@@ -3,7 +3,7 @@
; RUN: llvm-as -o %t.bc %s
;; Try to save statistics to file.
-; RUN: ld.lld --stats-file=%t2.stats -m elf_x86_64 -r -o %t.o %t.bc
+; RUN: ld.lld --plugin-opt=stats-file=%t2.stats -m elf_x86_64 -r -o %t.o %t.bc
; RUN: FileCheck --input-file=%t2.stats %s
; CHECK: {
diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py
index e0b8a824c4ef..0d5487eabd4d 100644
--- a/lld/test/lit.cfg.py
+++ b/lld/test/lit.cfg.py
@@ -74,7 +74,8 @@ llvm_config.feature_config(
'RISCV': 'riscv',
'Sparc': 'sparc',
'WebAssembly': 'wasm',
- 'X86': 'x86'})
+ 'X86': 'x86'}),
+ ('--assertion-mode', {'ON': 'asserts'}),
])
# Set a fake constant version so that we get consistent output.