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

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 11:49:59 PDT 2025


================
@@ -131,20 +133,48 @@ class CanonicalizationOfOmp {
       // Ignore compiler directives.
       if (GetConstructIf<parser::CompilerDirective>(*nextIt))
         continue;
+      // Keep track of the loops to handle the end loop directives
+      std::stack<parser::OpenMPLoopConstruct *> loops;
+      loops.push(&x);
+      if (auto *innerConstruct{
+              GetConstructIf<parser::OpenMPConstruct>(*nextIt)}) {
+        if (auto *innerOmpLoop{
+                std::get_if<parser::OpenMPLoopConstruct>(&innerConstruct->u)}) {
+          auto &innerBeginDir{
+              std::get<parser::OmpBeginLoopDirective>(innerOmpLoop->t)};
+          auto &innerDir{std::get<parser::OmpLoopDirective>(innerBeginDir.t)};
+          if (innerDir.v == llvm::omp::Directive::OMPD_tile) {
+            std::get<std::optional<
+                common::Indirection<parser::OpenMPLoopConstruct>>>(
+                loops.top()->t) = std::move(*innerOmpLoop);
----------------
kparzysz wrote:

Could you assign the lhs to a variable?  You're using the same expression again in the "loops.push" call.

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


More information about the llvm-commits mailing list