[llvm-branch-commits] [flang] [flang][OpenMP] Update `do concurrent` mapping pass to use `fir.do_concurrent` op (PR #138489)

Kareem Ergawy via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 6 11:53:22 PDT 2025


================
@@ -548,19 +357,16 @@ class DoConcurrentConversionPass
       return;
     }
 
-    llvm::DenseSet<fir::DoLoopOp> concurrentLoopsToSkip;
+    llvm::DenseSet<fir::DoConcurrentOp> concurrentLoopsToSkip;
----------------
ergawy wrote:

> I'm not certain that is guaranteed.

ops are walked [in pre-order](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Transforms/Utils/DialectConversion.cpp#L2679). So the parent op is guaranteed to be traversed before the nested ones.

> could we instead now skip any fir::DoConcurrentOp which has an ancestor which is a fir::DoConcurrentOp?

The problem is that we clone region of the parent `do concurrent` op to the newly created set of OMP ops including any nested `do concurrent` loops. Therefore, the condition of checking for a `do concurrent` ansector will not apply anymore.

I also do not like the gloabl list that much tbh. I am trying to think of a better solution.

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


More information about the llvm-branch-commits mailing list