Skip to content

Commit 57a064f

Browse files
committed
Revert "[compiler-rt] Add a critical section when flushing gcov counters"
See the discussion on PR44792. This reverts commit 02ce9d8.
1 parent 6f4f4f2 commit 57a064f

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

compiler-rt/lib/profile/GCDAProfiling.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,8 @@ typedef unsigned long long uint64_t;
6262
#include "InstrProfiling.h"
6363
#include "InstrProfilingUtil.h"
6464

65-
#ifndef _WIN32
66-
#include <pthread.h>
67-
static pthread_mutex_t gcov_flush_mutex = PTHREAD_MUTEX_INITIALIZER;
68-
static __inline void gcov_flush_lock() {
69-
pthread_mutex_lock(&gcov_flush_mutex);
70-
}
71-
static __inline void gcov_flush_unlock() {
72-
pthread_mutex_unlock(&gcov_flush_mutex);
73-
}
74-
#else
75-
#include <windows.h>
76-
static SRWLOCK gcov_flush_mutex = SRWLOCK_INIT;
77-
static __inline void gcov_flush_lock() {
78-
AcquireSRWLockExclusive(&gcov_flush_mutex);
79-
}
80-
static __inline void gcov_flush_unlock() {
81-
ReleaseSRWLockExclusive(&gcov_flush_mutex);
82-
}
83-
#endif
84-
8565
/* #define DEBUG_GCDAPROFILING */
66+
8667
/*
8768
* --- GCOV file format I/O primitives ---
8869
*/
@@ -639,16 +620,12 @@ void llvm_register_flush_function(fn_ptr fn) {
639620
}
640621

641622
void __gcov_flush() {
642-
gcov_flush_lock();
643-
644623
struct fn_node* curr = flush_fn_list.head;
645624

646625
while (curr) {
647626
curr->fn();
648627
curr = curr->next;
649628
}
650-
651-
gcov_flush_unlock();
652629
}
653630

654631
COMPILER_RT_VISIBILITY

0 commit comments

Comments
 (0)