[llvm-branch-commits] [llvm] [LLVM][OpenMP] Implement getLeafOrCompositeConstructs (PR #89104)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 22 05:32:09 PDT 2024


================
@@ -25,6 +25,43 @@ using namespace llvm::omp;
 #define GEN_DIRECTIVES_IMPL
 #include "llvm/Frontend/OpenMP/OMP.inc"
 
+static iterator_range<ArrayRef<Directive>::iterator>
+getFirstCompositeRange(iterator_range<ArrayRef<Directive>::iterator> Leafs) {
----------------
skatrak wrote:

My understanding is that there can only be at most a single composite construct when decomposing any given compound construct. So there wouldn't be a "first" composite range, but rather one composite range or none. In fact, if there is a composite range, it must also be at the end of the construct.

So, something like this: `<composite-construct><other-leaf>` can't happen. Decomposing a single compound construct into a list of leaves while keeping composite constructs as a unit should be as simple as forwarding all block-associated leaves until finding a loop-associated leaf and then aggregating (via `getCompoundConstruct()`) everything from there until the end of the leaf list to append one composite or single loop construct.

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


More information about the llvm-branch-commits mailing list