[llvm-branch-commits] [flang] [flang][OpenMP] Implement LoopSequence class, calculate sequence length (PR #185296)

Krzysztof Parzyszek via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 9 06:53:50 PDT 2026


================
@@ -751,4 +769,69 @@ std::optional<int64_t> GetNumGeneratedNestsFrom(
   // For every other loop construct return 1.
   return 1;
 }
+
+LoopSequence::LoopSequence(
+    const parser::ExecutionPartConstruct &root, bool allowAllLoops)
+    : allowAllLoops_(allowAllLoops) {
+  entry_ = createConstructEntry(root);
+  assert(entry_ && "Expecting loop like code");
----------------
kparzysz wrote:

`createConstructEntry` is kind of a filter that returns an object for a given ExecutionPartConstruct if the EPC corresponds to a loop or a loop-transforming construct.  For any other EPC it will return a null pointer.  It exists as a separate function because otherwise the same checks would have to be repeated in all constructors.

A LoopSequence can only be created for a construct for which createConstructEntry returns non-null.

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


More information about the llvm-branch-commits mailing list