[llvm-branch-commits] [compiler-rt] 57a064f - Revert "[compiler-rt] Add a critical section when flushing gcov counters"

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Feb 26 04:34:48 PST 2020


Author: Hans Wennborg
Date: 2020-02-26T13:34:20+01:00
New Revision: 57a064f8dc8301ce8b017c84782286816dc58911

URL: https://github.com/llvm/llvm-project/commit/57a064f8dc8301ce8b017c84782286816dc58911
DIFF: https://github.com/llvm/llvm-project/commit/57a064f8dc8301ce8b017c84782286816dc58911.diff

LOG: Revert "[compiler-rt] Add a critical section when flushing gcov counters"

See the discussion on PR44792.

This reverts commit 02ce9d8ef5a84bc884de4105eae5f8736ef67634.

Added: 
    

Modified: 
    compiler-rt/lib/profile/GCDAProfiling.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index 81f2cdd26450..498c05900bf2 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -62,27 +62,8 @@ typedef unsigned long long uint64_t;
 #include "InstrProfiling.h"
 #include "InstrProfilingUtil.h"
 
-#ifndef _WIN32
-#include <pthread.h>
-static pthread_mutex_t gcov_flush_mutex = PTHREAD_MUTEX_INITIALIZER;
-static __inline void gcov_flush_lock() {
-  pthread_mutex_lock(&gcov_flush_mutex);
-}
-static __inline void gcov_flush_unlock() {
-  pthread_mutex_unlock(&gcov_flush_mutex);
-}
-#else
-#include <windows.h>
-static SRWLOCK gcov_flush_mutex = SRWLOCK_INIT;
-static __inline void gcov_flush_lock() {
-  AcquireSRWLockExclusive(&gcov_flush_mutex);
-}
-static __inline void gcov_flush_unlock() {
-  ReleaseSRWLockExclusive(&gcov_flush_mutex);
-}
-#endif
-
 /* #define DEBUG_GCDAPROFILING */
+
 /*
  * --- GCOV file format I/O primitives ---
  */
@@ -639,16 +620,12 @@ void llvm_register_flush_function(fn_ptr fn) {
 }
 
 void __gcov_flush() {
-  gcov_flush_lock();
-
   struct fn_node* curr = flush_fn_list.head;
 
   while (curr) {
     curr->fn();
     curr = curr->next;
   }
-
-  gcov_flush_unlock();
 }
 
 COMPILER_RT_VISIBILITY


        


More information about the llvm-branch-commits mailing list