[flang-commits] [flang] [flang][OpenMP] Restrict isSafeToParallelize to write-only thread-local effects (PR #188595)

Jack Styles via flang-commits flang-commits at lists.llvm.org
Fri Mar 27 03:30:05 PDT 2026


================
@@ -236,19 +236,25 @@ static bool isSafeToParallelize(Operation *op) {
 
   // Thread-local variables allocated in the OpenMP parallel region or coming
   // from privatizing clauses are private to each thread and thus safe (and
-  // sometimes required) to parallelize. If the compiler wraps such load/stores
-  // in an omp.single block, only one thread updates its local copy, while
-  // all other threads read uninitialized data (see issue #143330).
-  // Use MemoryEffectOpInterface to check all memory effects generically.
-  // This also handles hlfir.assign which is present when the pass runs before
----------------
Stylie777 wrote:

Can a test be added for when hlfir.assign cannot be parallelised?

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


More information about the flang-commits mailing list