[flang] [llvm] [Flang] Adding lowering for the allocation and deallocation of coarrays (PR #182110)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 06:36:38 PST 2026


================
@@ -884,13 +908,32 @@ genDeallocate(fir::FirOpBuilder &builder,
               Fortran::lower::AbstractConverter &converter, mlir::Location loc,
               const fir::MutableBoxValue &box, ErrorManager &errorManager,
               mlir::Value declaredTypeDesc = {},
-              const Fortran::semantics::Symbol *symbol = nullptr) {
+              const Fortran::semantics::Symbol *symbol = nullptr,
+              const Fortran::lower::SomeExpr *allocExpr = nullptr) {
   bool isCudaSymbol = symbol && Fortran::semantics::HasCUDAAttr(*symbol);
   bool isCudaDeviceContext = cuf::isCUDADeviceContext(builder.getRegion());
   bool inlineDeallocation =
       !box.isDerived() && !box.isPolymorphic() && !box.hasAssumedRank() &&
       !box.isUnlimitedPolymorphic() && !errorManager.hasStatSpec() &&
       !useAllocateRuntime && !box.isPointer();
+
+  std::optional<Fortran::evaluate::DataRef> dataRef =
+      !allocExpr ? std::nullopt : Fortran::evaluate::ExtractDataRef(allocExpr);
----------------
jeanPerier wrote:

unused? (and then no need for the new `allocExpr` argument).

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


More information about the llvm-commits mailing list