[compiler-rt] [rtsan] Add exit statistics (PR #109885)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 11:32:43 PDT 2024


================
@@ -44,9 +45,15 @@ static InitializationState GetInitializationState() {
       atomic_load(&rtsan_initialized, memory_order_acquire));
 }
 
+static void RtsanAtexit() { PrintStatisticsSummary(); }
+
 static auto OnViolationAction(DiagnosticsInfo info) {
   return [info]() {
-    __rtsan::PrintDiagnostics(info);
+    if (flags().print_stats_on_exit)
+      IncrementTotalErrorCount();
----------------
fmayer wrote:

My guess would be that increment is cheaper than a branch but I don't think it's worth spending time on.

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


More information about the llvm-commits mailing list