Index: lld/ELF/Driver.cpp =================================================================== --- lld/ELF/Driver.cpp +++ lld/ELF/Driver.cpp @@ -593,8 +593,7 @@ if (config->timeTraceEnabled) { checkError(timeTraceProfilerWrite( - args.getLastArgValue(OPT_time_trace_file_eq).str(), - config->outputFile)); + args.getLastArgValue(OPT_time_trace_eq).str(), config->outputFile)); timeTraceProfilerCleanup(); } } @@ -1184,7 +1183,7 @@ getOldNewOptions(args, OPT_thinlto_prefix_replace_eq); config->thinLTOModulesToCompile = args::getStrings(args, OPT_thinlto_single_module_eq); - config->timeTraceEnabled = args.hasArg(OPT_time_trace); + config->timeTraceEnabled = args.hasArg(OPT_time_trace, OPT_time_trace_eq); config->timeTraceGranularity = args::getInteger(args, OPT_time_trace_granularity, 500); config->trace = args.hasArg(OPT_trace); Index: lld/ELF/Options.td =================================================================== --- lld/ELF/Options.td +++ lld/ELF/Options.td @@ -408,8 +408,9 @@ "Number of threads. '1' disables multi-threading. By default all " "available hardware threads are used">; -def time_trace: FF<"time-trace">, HelpText<"Record time trace">; -def time_trace_file_eq: JJ<"time-trace-file=">, HelpText<"Specify time trace output file">; +def time_trace: FF<"time-trace">, HelpText<"Record time trace to file next to output">; +def time_trace_eq: JJ<"time-trace=">, MetaVarName<"">, + HelpText<"Record time trace to ">; defm time_trace_granularity: EEq<"time-trace-granularity", "Minimum time granularity (in microseconds) traced by time profiler">; Index: lld/MachO/Driver.cpp =================================================================== --- lld/MachO/Driver.cpp +++ lld/MachO/Driver.cpp @@ -1494,8 +1494,7 @@ config->progName = argsArr[0]; - config->timeTraceEnabled = args.hasArg( - OPT_time_trace, OPT_time_trace_granularity_eq, OPT_time_trace_file_eq); + config->timeTraceEnabled = args.hasArg(OPT_time_trace, OPT_time_trace_eq); config->timeTraceGranularity = args::getInteger(args, OPT_time_trace_granularity_eq, 500); @@ -1631,8 +1630,7 @@ if (config->timeTraceEnabled) { checkError(timeTraceProfilerWrite( - args.getLastArgValue(OPT_time_trace_file_eq).str(), - config->outputFile)); + args.getLastArgValue(OPT_time_trace_eq).str(), config->outputFile)); timeTraceProfilerCleanup(); } Index: lld/MachO/Options.td =================================================================== --- lld/MachO/Options.td +++ lld/MachO/Options.td @@ -43,14 +43,16 @@ def no_lto_legacy_pass_manager : Flag<["--"], "no-lto-legacy-pass-manager">, HelpText<"Use the new pass manager in LLVM">, Group; -def time_trace: Flag<["--"], "time-trace">, HelpText<"Record time trace">, +def time_trace: Flag<["--"], "time-trace">, + HelpText<"Record time trace to file next to output">, + Group; +def time_trace_eq: Joined<["--"], "time-trace=">, + HelpText<"Record time trace to ">, + MetaVarName<"">, Group; def time_trace_granularity_eq: Joined<["--"], "time-trace-granularity=">, HelpText<"Minimum time granularity (in microseconds) traced by time profiler">, Group; -def time_trace_file_eq: Joined<["--"], "time-trace-file=">, - HelpText<"Specify time trace output file">, - Group; def deduplicate_literals: Flag<["--"], "deduplicate-literals">, HelpText<"Enable literal deduplication. This is implied by --icf={safe,all}">, Group; Index: lld/test/ELF/time-trace.s =================================================================== --- lld/test/ELF/time-trace.s +++ lld/test/ELF/time-trace.s @@ -8,13 +8,13 @@ # RUN: | FileCheck %s # Test specified trace file name -# RUN: ld.lld --time-trace --time-trace-file=%t2.json --time-trace-granularity=0 -o %t2.elf %t.o +# RUN: ld.lld --time-trace=%t2.json --time-trace-granularity=0 -o %t2.elf %t.o # RUN: cat %t2.json \ # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ # RUN: | FileCheck %s # Test trace requested to stdout -# RUN: ld.lld --time-trace --time-trace-file=- --time-trace-granularity=0 -o %t3.elf %t.o \ +# RUN: ld.lld --time-trace=- --time-trace-granularity=0 -o %t3.elf %t.o \ # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ # RUN: | FileCheck %s Index: lld/test/MachO/time-trace.s =================================================================== --- lld/test/MachO/time-trace.s +++ lld/test/MachO/time-trace.s @@ -11,14 +11,14 @@ # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ # RUN: | FileCheck %s -## Test specified trace file name, also test that `--time-trace` is not needed if the other two are used. -# RUN: %lld --time-trace-file=%t2.json --time-trace-granularity=0 -o %t2.macho %t.o +## Test specified trace file name. +# RUN: %lld --time-trace=%t2.json --time-trace-granularity=0 -o %t2.macho %t.o # RUN: cat %t2.json \ # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ # RUN: | FileCheck %s -## Test trace requested to stdout, also test that `--time-trace` is not needed if the other two are used. -# RUN: %lld --time-trace-file=- --time-trace-granularity=0 -o %t3.macho %t.o \ +## Test trace requested to stdout. +# RUN: %lld --time-trace=- --time-trace-granularity=0 -o %t3.macho %t.o \ # RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \ # RUN: | FileCheck %s