[flang] [llvm] [mlir] [flang][OpenMP] Enable tiling (PR #143715)

Jan Leyonberg via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 06:46:44 PDT 2025


================
@@ -5024,8 +5024,9 @@ struct OpenMPBlockConstruct {
 struct OpenMPLoopConstruct {
   TUPLE_CLASS_BOILERPLATE(OpenMPLoopConstruct);
   OpenMPLoopConstruct(OmpBeginLoopDirective &&a)
-      : t({std::move(a), std::nullopt, std::nullopt}) {}
+      : t({std::move(a), std::nullopt, std::nullopt, std::nullopt}) {}
   std::tuple<OmpBeginLoopDirective, std::optional<DoConstruct>,
+      std::optional<common::Indirection<OpenMPLoopConstruct>>,
----------------
jsjodin wrote:

I agree that having the nesting done in this way is a better approach, I forgot that I actually tried out putting the DoConstruct inside the innermost OpenMPLoopConstruct, and the code generation was fine, my comment above was incorrect. The parse tree after canonicalization looks like this:
```
| | ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPLoopConstruct
| | | OmpBeginLoopDirective
| | | | OmpLoopDirective -> llvm::omp::Directive = do
| | | | OmpClauseList -> 
| | | OpenMPLoopConstruct
| | | | OmpBeginLoopDirective
| | | | | OmpLoopDirective -> llvm::omp::Directive = tile
| | | | | OmpClauseList -> OmpClause -> Sizes -> Scalar -> Integer -> Expr = '2_4'
| | | | | | LiteralConstant -> IntLiteralConstant = '2'
| | | | DoConstruct
| | | | | NonLabelDoStmt
| | | | | | LoopControl -> LoopBounds
| | | | | | | Scalar -> Name = 'x'
| | | | | | | Scalar -> Expr = '1_4'
| | | | | | | | LiteralConstant -> IntLiteralConstant = '1'
| | | | | | | Scalar -> Expr = '100_4'
| | | | | | | | LiteralConstant -> IntLiteralConstant = '100'
```
So this should be pretty compatible with what you are working on.

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


More information about the llvm-commits mailing list