[Mlir-commits] [flang] [llvm] [mlir] [openmp] [MLIR][OpenMP] Add omp.fuse operation (PR #168898)

Ferran Toda llvmlistbot at llvm.org
Fri Nov 28 06:49:55 PST 2025


================
@@ -2233,7 +2287,8 @@ static void genUnrollOp(Fortran::lower::AbstractConverter &converter,
 
   // Emit the associated loop
   llvm::SmallVector<mlir::omp::CanonicalLoopOp, 1> canonLoops;
-  genCanonicalLoopNest(converter, symTable, semaCtx, eval, loc, queue, item, 1,
+  genCanonicalLoopNest(converter, symTable, semaCtx, eval,
+                       eval.getFirstNestedEvaluation(), loc, queue, item, 1,
----------------
NouTimbaler wrote:

Thanks for the comment!
`eval` in a loop sequence looks something like this:
```
OpenMPConstruct
    Loop 1
    Loop 2
End OpenMPConstruct
```
Originally the `genCanonicalLoopNest` function would only generate a loop for the first nested evaluation of `eval` using `getFirstNestedEvaluation`. 
Instead of making `genCanonicalLoopNest` generate a sequence of loops i opted for selecting which nested evaluation to generate. For the majority of the cases it would be trivial since at the moment only `omp fuse` has a loop sequence.
I'm open to suggestions if you think another design is more suitable for this case.

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


More information about the Mlir-commits mailing list