[Mlir-commits] [flang] [mlir] [flang][OpenMP] Support for "!$omp dispatch". (PR #203320)

Sergio Afonso llvmlistbot at llvm.org
Tue Jun 16 04:10:01 PDT 2026


================
@@ -5264,9 +5279,24 @@ static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
 static void genOMP(lower::AbstractConverter &converter, lower::SymMap &symTable,
                    semantics::SemanticsContext &semaCtx,
                    lower::pft::Evaluation &eval,
-                   const parser::OpenMPDispatchConstruct &) {
-  if (!semaCtx.langOptions().OpenMPSimd)
-    TODO(converter.getCurrentLocation(), "OpenMPDispatchConstruct");
+                   const parser::OpenMPDispatchConstruct &dispatchConstruct) {
+  const parser::OmpDirectiveSpecification &beginSpec =
+      dispatchConstruct.BeginDir();
+  List<Clause> clauses = makeClauses(beginSpec.Clauses(), semaCtx);
+  if (auto &endSpec = dispatchConstruct.EndDir())
+    clauses.append(makeClauses(endSpec->Clauses(), semaCtx));
+
+  llvm::omp::Directive directive = beginSpec.DirId();
+  mlir::Location currentLocation = converter.genLocation(beginSpec.source);
+
+  if (!clauses.empty())
+    TODO(currentLocation, "OpenMP Dispatch clauses");
----------------
skatrak wrote:

Nit: I would suggest adding a `genDispatchClauses` function to the "Code generation functions for clauses" section of this file where you create a `ClauseProcessor` and call `processTODO` on it with the full list of clauses that apply to `!$omp dispatch`, instead of making this check directly here.

That's the general pattern we follow for the other directives and would make it easier to progressively start adding support for clauses over time.

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


More information about the Mlir-commits mailing list