[NFC][flang][OpenMP] Add comment for handling the data race problem in copyin clause

The reference and description is missed before.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D129437
This commit is contained in:
Peixin Qiao 2022-07-12 19:54:24 +08:00
parent 68cc1eeb1d
commit 13019955bf

View file

@ -228,6 +228,11 @@ genCopyinClause(Fortran::lower::AbstractConverter &converter,
}
}
}
// [OMP 5.0, 2.19.6.1] The copy is done after the team is formed and prior to
// the execution of the associated structured block. Emit implicit barrier to
// synchronize threads and avoid data races on propagation master's thread
// values of threadprivate variables to local instances of that variables of
// all other implicit threads.
if (hasCopyin)
firOpBuilder.create<mlir::omp::BarrierOp>(converter.getCurrentLocation());
firOpBuilder.restoreInsertionPoint(insPt);