[Mlir-commits] [flang] [mlir] [Flang][MLIR] Add `!$omp unroll` and `omp.unroll_heuristic` (PR #144785)

Michael Kruse llvmlistbot at llvm.org
Fri Jun 20 05:27:17 PDT 2025


================
@@ -5866,6 +5927,23 @@ convertHostOrTargetOperation(Operation *op, llvm::IRBuilderBase &builder,
                 // etc. and then discarded
                 return success();
               })
+          .Case([&](omp::NewCliOp op) {
+            // Meta-operation: Doesn't do anything by itself, but used to
+            // identify a loop.
+            return success();
+          })
+          .Case([&](omp::CanonicalLoopOp op) {
+            return convertOmpCanonicalLoopOp(op, builder, moduleTranslation);
+          })
+          .Case([&](omp::UnrollHeuristicOp op) {
+            // FIXME: Handling omp.unroll_heuristic as an executable requires
+            // that the generator (e.g. omp.canonical_loop) has been seen first.
+            // For construct that require all codegen to occur inside a callback
+            // (e.g. OpenMPIRBilder::createParallel), all codegen of that
+            // contained region including their transformations must occur at
+            // the omp.canonical_loop.
----------------
Meinersbur wrote:

This is meant to be a temporary limitation, and eventually be lifted. See it as "not yet implemented" rather than an API requirement.

Lifting this limitation is not a choice: For OpenMPIRBuilder methods that work using callbacks, we need to be independent of iteration order.

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


More information about the Mlir-commits mailing list