Add missing memory barrier for queuing locks

Otherwise I see hangs in the omp_single_copyprivate test when
compiling in release mode. With the debug assertions, I get a
failure `head > 0 && tail > 0`.

Differential Revision: https://reviews.llvm.org/D40722

llvm-svn: 320150
This commit is contained in:
Jonas Hahnfeld 2017-12-08 15:07:02 +00:00
parent dfa430f694
commit 86c307821c
2 changed files with 2 additions and 1 deletions

View File

@ -1456,6 +1456,7 @@ int __kmp_release_queuing_lock(kmp_queuing_lock_t *lck, kmp_int32 gtid) {
}
dequeued = FALSE;
} else {
KMP_MB();
tail = *tail_id_p;
if (head == tail) { /* only one thread on the queue */
#ifdef DEBUG_QUEUING_LOCKS

View File

@ -13,7 +13,7 @@ int test_omp_single_copyprivate()
result = 0;
nr_iterations = 0;
#pragma omp parallel
#pragma omp parallel num_threads(4)
{
int i;
for (i = 0; i < LOOPCOUNT; i++)