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

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 17:17:37 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();
----------------
cjappl wrote:

Is it more costly to always do the check, or just always increment a relaxed atomic?

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


More information about the llvm-commits mailing list