[llvm] [gold] Enable time trace profiler in LLVMgold (PR #94293)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 09:29:52 PDT 2024


================
@@ -1113,6 +1131,19 @@ static ld_plugin_status allSymbolsReadHook() {
   if (unsigned NumOpts = options::extra.size())
     cl::ParseCommandLineOptions(NumOpts, &options::extra[0]);
 
+  // Initialize time trace profiler
+  if (!options::time_trace_file.empty())
+    llvm::timeTraceProfilerInitialize(options::time_trace_granularity,
+                                      options::extra.size() ? options::extra[0]
+                                                            : "LLVMgold");
----------------
mshockwave wrote:

I think we reach this line (line 316) only if there are additional `-plugin-opt` that LLVMgold doesn't recognize. If there aren't any of those, I think `options::extra` will remain empty.

https://github.com/llvm/llvm-project/pull/94293


More information about the llvm-commits mailing list