[clang] [CIR][OpenMP] Add support for combined target parallel directives (PR #207019)

Sergio Afonso via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 05:30:43 PDT 2026


================
@@ -30,14 +32,34 @@ CIRGenFunction::emitOMPErrorDirective(const OMPErrorDirective &s) {
   getCIRGenModule().errorNYI(s.getSourceRange(), "OpenMP OMPErrorDirective");
   return mlir::failure();
 }
-mlir::LogicalResult
-CIRGenFunction::emitOMPParallelDirective(const OMPParallelDirective &s) {
-  mlir::LogicalResult res = mlir::success();
-  mlir::Location begin = getLoc(s.getBeginLoc());
-  mlir::Location end = getLoc(s.getEndLoc());
+
+/// Returns the subset of \p s's clauses that are allowed on the given leaf
+/// directive.
+static llvm::SmallVector<const OMPClause *>
+getLeafClauses(CIRGenFunction &cgf, const OMPExecutableDirective &s,
----------------
skatrak wrote:

I think this is quite an oversimplification of the construct decomposition logic. Though properly decomposing OpenMP constructs in Clang's AST is a much larger task, so this is probably fine for a starting point.

@kparzysz do you have any thoughts on this? Would there be a way to introduce this for ClangIR only, to avoid having to rewrite all existing OpenMP support in Clang as part of the change?

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


More information about the cfe-commits mailing list