[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:23 PDT 2026


================
@@ -0,0 +1,17 @@
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=51 -o - %s | FileCheck %s
+
+subroutine test_unroll_full
+  integer res, i
+
+  !$omp unroll full
----------------
sbryngelson wrote:

I cannot write this one, because the composition is broken today and not by this patch:

| outer | ops emitted |
|---|---|
| `unroll full` + `tile` | `omp.unroll_full` only, tile dropped |
| `unroll` + `tile` | `omp.unroll_heuristic` only, tile dropped |
| `unroll partial(2)` + `tile` | `omp.unroll_partial` only, tile dropped |
| `tile` alone | `omp.tile (%grid1, %intratile1) <- (%canonloop) sizes(...)` |

`getNestedDoConstruct` descends through an intervening OpenMP construct to reach the DO, so the nested construct is never lowered. Chaining needs the unrolled loop as a generatee, which `omp.unroll_*` does not provide.

Since it affects the two unroll forms that predate this PR, I did not implement chaining here. I added a `TODO` so it is diagnosed rather than silently dropped, plus `flang/test/Lower/OpenMP/Todo/unroll-nested-transform.f90`. Happy to split that into a separate patch if you prefer.

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


More information about the flang-commits mailing list