[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Support the FULL clause on the UNROLL construct (PR #214115)
Spencer Bryngelson via flang-commits
flang-commits at lists.llvm.org
Wed Aug 5 07:35:22 PDT 2026
================
@@ -557,6 +557,36 @@ def UnrollHeuristicOp : OpenMPTransform_Op<"unroll_heuristic", []> {
let hasCustomAssemblyFormat = 1;
}
+//===----------------------------------------------------------------------===//
+// OpenMP unroll_full operation
+//===----------------------------------------------------------------------===//
+
+def UnrollFullOp : OpenMPTransform_Op<"unroll_full", []> {
----------------
sbryngelson wrote:
Added a verifier, but not the constant-bounds check, and I would like your read on it.
flang emits the trip count as a computed value even for a literal loop:
```mlir
%14 = arith.select %13, %c0_i32, %12 : i32
omp.canonical_loop(%canonloop) %iv : i32 in range(%14) { ... }
omp.unroll_full(%canonloop)
```
so `matchPattern(tripCount, m_Constant())` rejects flangs own output for `do i = 1, 100` -- it failed my two new tests. Verifiers run before folding, and `getConstantIntValue` only matches literal constants too, so I could not express "constant after folding" at that boundary. The verifier currently checks only that the applyee has a generator.
Options: leave it to semantics; fold the trip count in flang before emitting; or add a fold-aware check. Happy to do whichever you prefer.
https://github.com/llvm/llvm-project/pull/214115
More information about the flang-commits
mailing list