[clang] [llvm] [Clang][OpenMP] Implement Loop splitting `#pragma omp split` directive (PR #183261)

Michael Kruse via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 04:13:38 PDT 2026


================
@@ -0,0 +1,29 @@
+// Check no warnings/errors and that split is recognized
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// Check AST: OMPSplitDirective with associated for-loop
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-dump %s | FileCheck %s --check-prefix=DUMP
+
+// Check unparsing
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s --check-prefix=PRINT
+
+#ifndef HEADER
+#define HEADER
+
+extern "C" void body(...);
+
+// PRINT-LABEL: void foo(
+// DUMP-LABEL:  FunctionDecl {{.*}} foo
+void foo(int n) {
+  // PRINT:     #pragma omp split counts(2, 3)
+  // DUMP:      OMPSplitDirective
+  // DUMP: OMPCountsClause
+  #pragma omp split counts(2, 3)
----------------
Meinersbur wrote:

```suggestion
  #pragma omp split counts(2, omp_fill)
```
By the OpenMP specification, one of the `counts` list items must be the keyword. This is because `n` does not necessarily equal 5.




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


More information about the cfe-commits mailing list