[llvm-branch-commits] [flang] [Flang][OpenMP][Lower] Refactor lowering of compound constructs (PR #87070)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 29 07:54:30 PDT 2024


================
@@ -710,6 +710,81 @@ genOpenMPReduction(Fortran::lower::AbstractConverter &converter,
   }
 }
 
+/// Split a combined directive into an outer leaf directive and the (possibly
+/// combined) rest of the combined directive. Composite directives and
+/// non-compound directives are not split, in which case it will return the
+/// input directive as its first output and an empty value as its second output.
+static std::pair<llvm::omp::Directive, std::optional<llvm::omp::Directive>>
----------------
skatrak wrote:

> We have llvm::omp::getLeafConstructs that breaks up any combined/composite directive into leafs.

That might be useful here, though if it splits up composite constructs too maybe it wouldn't be as straightforward to use in this case. Does it provide a relatively clean way to split something like `teams distribute simd` into `[teams, distribute simd]` rather than `[teams, distribute, simd]`?

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


More information about the llvm-branch-commits mailing list