[flang-commits] [flang] [mlir] [mlir][OpenMP][flang] make private variable allocation implicit in omp.private (PR #124019)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Fri Jan 24 12:33:08 PST 2025


================
@@ -138,13 +145,20 @@ void Fortran::lower::omp::populateByRefInitAndCleanupRegions(
     fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type argType,
     mlir::Value scalarInitValue, mlir::Block *initBlock,
     mlir::Value allocatedPrivVarArg, mlir::Value moldArg,
-    mlir::Region &cleanupRegion, bool isPrivate) {
+    mlir::Region &cleanupRegion, bool isPrivate,
+    const Fortran::semantics::Symbol *sym) {
   mlir::Type ty = fir::unwrapRefType(argType);
   builder.setInsertionPointToEnd(initBlock);
   auto yield = [&](mlir::Value ret) {
     builder.create<mlir::omp::YieldOp>(loc, ret);
   };
 
+  if (isPrivate)
+    assert(sym && "Symbol information is needed to privatize derived types");
----------------
luporl wrote:

nit: you could eliminate the `if` with `assert((!isPrivate || sym) && ...)`.

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


More information about the flang-commits mailing list