[flang-commits] [flang] [flang][fir] Lower `do concurrent` loop nests to `fir.do_concurrent` (PR #132904)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Thu Apr 3 20:48:01 PDT 2025
================
@@ -279,6 +279,9 @@ mlir::Block *fir::FirOpBuilder::getAllocaBlock() {
if (auto cufKernelOp = getRegion().getParentOfType<cuf::KernelOp>())
return &cufKernelOp.getRegion().front();
+ if (auto doConcurentOp = getRegion().getParentOfType<fir::DoConcurrentOp>())
+ return doConcurentOp.getBody();
----------------
ergawy wrote:
You are right, I got confused here. This is still fine since the temp allocations will be emitted in the `fir.do_concurrent` wrapper op not the `fir.do_concurrent.loop` op. When serialized (i.e. converted to `fir.do_loop ... unordered` nest), these allocations are moved to the alloca block (see https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/Transforms/SimplifyFIROperations.cpp#L167-L176). For OpenMP, I call these "loop-local values", these values are privatized by the do concurrent to OpenMP pass (see https://github.com/llvm/llvm-project/pull/127635).
https://github.com/llvm/llvm-project/pull/132904
More information about the flang-commits
mailing list