[clang] [llvm] [TimeProfiler][Clang] Add zstd-compressed time-trace output support (PR #228627)

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 5 01:28:46 PDT 2026


================
@@ -437,14 +474,35 @@ Error llvm::timeTraceProfilerWrite(StringRef PreferredFileName,
   if (Path.empty()) {
     Path = FallbackFileName == "-" ? "out" : FallbackFileName.str();
     Path += TimeTraceFileExtension;
+    if (TimeTraceProfilerInstance->TimeTraceCompress ==
----------------
chandlerc wrote:

Done — switched to your suggested `if (Path.empty()) ... else if (CompressType == DebugCompressionType::None)` structure, which is much clearer!

And yes, not mutating a non-empty `PreferredFileName` when `CompressType == Zstd` is WAI: if a caller or user explicitly specifies an output file path (e.g., `-ftime-trace=custom.out`), we write to the exact path they requested rather than silently renaming it, and only append `.zst` when synthesizing a default filename.

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


More information about the cfe-commits mailing list