[flang-commits] [flang] [Flang][OpenMP]Make Do concurrent indices private (PR #93785)

via flang-commits flang-commits at lists.llvm.org
Thu May 30 20:40:30 PDT 2024


================
@@ -1721,6 +1721,25 @@ bool OmpAttributeVisitor::Pre(const parser::DoConstruct &x) {
           }
         }
       }
+    } else if (x.IsDoConcurrent()) {
+      const Fortran::parser::LoopControl *loopControl = &*x.GetLoopControl();
+      const Fortran::parser::LoopControl::Concurrent &concurrent =
+          std::get<Fortran::parser::LoopControl::Concurrent>(loopControl->u);
+      const Fortran::parser::ConcurrentHeader &concurrentHeader =
+          std::get<Fortran::parser::ConcurrentHeader>(concurrent.t);
+      const std::list<Fortran::parser::ConcurrentControl> &controls =
+          std::get<std::list<Fortran::parser::ConcurrentControl>>(
+              concurrentHeader.t);
+      for (const auto &control : controls) {
+        const parser::Name *iv{&std::get<0>(control.t)};
+        if (iv && iv->symbol) {
+          if (!iv->symbol->test(Symbol::Flag::OmpPreDetermined)) {
+            ResolveSeqLoopIndexInParallelOrTaskConstruct(*iv);
+          } else {
+            // TODO: conflict checks with explicitly determined DSA
+          }
+        }
+      }
----------------
harishch4 wrote:

 **The loop iteration variable may not appear in a threadprivatedirective**. Yeah, sorry I missed it. If it's okay, I'll store symbols in a list and move common code out. 

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


More information about the flang-commits mailing list