[flang-commits] [flang] [llvm] [flang][MIF] Adding lowering for EVENT POST/WAIT statements (PR #210283)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 7 20:02:36 PDT 2026
================
@@ -1190,9 +1305,21 @@ struct MIFAllocCoarrayOpConversion
builder, loc, ftype, op.getLcobounds(), op.getUcobounds(), sizeInBytes,
finalFunc, coarrayHandle, allocMem, stat, errmsgArg, errmsgAllocArg);
fir::CallOp callOp = fir::CallOp::create(builder, loc, funcOp, args);
-
storeCoarrayHandle(builder, loc, coarrayHandle, op.getUniqName().str());
+ // Set new base_addr for the coarray descriptor
+ mlir::Value addrRef =
+ fir::factory::genCPtrOrCFunptrAddr(builder, loc, allocMem, ptrTy);
+ allocMem = fir::LoadOp::create(builder, loc, addrRef);
+ mlir::func::FuncOp sbaFunc =
+ fir::runtime::getRuntimeFunc<mkRTKey(AllocatableSetBaseAddr)>(loc,
+ builder);
+ llvm::SmallVector<mlir::Value> args2{fir::runtime::createArguments(
+ builder, loc, sbaFunc.getFunctionType(), op.getBox(), allocMem)};
+ fir::CallOp::create(builder, loc, sbaFunc, args2);
+ if (fir::isa_builtin_event_type(
----------------
MattPD wrote:
FWIW, as for the effort, replacing this `fir::isa_builtin_event_type` check with `mlir::isa<fir::RecordType>` was enough in a quick local test. The ALLOCATE path in `MutableBox.cpp` already uses `mlir::isa<fir::RecordType>`. With a single-image PRIF stand-in, default initialization then works for nonallocatable and allocatable coarrays, including a type with an `EVENT_TYPE` component. The existing MIF tests still pass.
https://github.com/llvm/llvm-project/pull/210283
More information about the flang-commits
mailing list