[flang-commits] [flang] [llvm] [flang][MIF] Update prif_coarray_handle in accordance with PRIF 0.8 #214080 (PR #214747)

via flang-commits flang-commits at lists.llvm.org
Fri Aug 7 07:47:28 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Jean-Didier PAILLEUX (JDPailleux)

<details>
<summary>Changes</summary>

In PRIF revision 0.8, the representation of `prif_coarray_handle` was changed. This PR updates this representation for this type and updates the MIFOpConversion pass for the relevant operations.
Fixes issue #<!-- -->214080
A minor fix has been made to the deallocation to ensure that, on the Flang side, the variable is properly deallocated, since previously the deallocation was only performed at the `coarray_handle` level.

---

Patch is 117.38 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/214747.diff


4 Files Affected:

- (modified) flang-rt/lib/runtime/__fortran_builtins.f90 (+4) 
- (modified) flang/lib/Optimizer/Transforms/MIFOpConversion.cpp (+49-58) 
- (modified) flang/test/Fir/MIF/coarray-alloc.mlir (+259-237) 
- (modified) flang/test/Lower/MIF/coarray_dealloc_not_alloc.f90 (+2-3) 


``````````diff
diff --git a/flang-rt/lib/runtime/__fortran_builtins.f90 b/flang-rt/lib/runtime/__fortran_builtins.f90
index 840ad33eb2674..8c3983f38dd31 100644
--- a/flang-rt/lib/runtime/__fortran_builtins.f90
+++ b/flang-rt/lib/runtime/__fortran_builtins.f90
@@ -108,6 +108,10 @@
     type(__builtin_dummy_team_descriptor_type), pointer, private :: info => null()
   end type
 
+  type, public, bind(C) :: __builtin_prif_coarray_handle_type
+    type(__builtin_c_ptr), private :: info
+  end type
+
   integer, parameter, public :: __builtin_atomic_int_kind = selected_int_kind(18)
   integer, parameter, public :: &
     __builtin_atomic_logical_kind = __builtin_atomic_int_kind
diff --git a/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp b/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
index efcb465016935..685fc52c08a77 100644
--- a/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/MIFOpConversion.cpp
@@ -13,6 +13,7 @@
 #include "flang/Optimizer/Builder/MIFCommon.h"
 #include "flang/Optimizer/Builder/MutableBox.h"
 #include "flang/Optimizer/Builder/Runtime/Inquiry.h"
+#include "flang/Optimizer/Builder/Runtime/Pointer.h"
 #include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
 #include "flang/Optimizer/CodeGen/TypeConverter.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
@@ -63,47 +64,31 @@ genBoxedSequenceType(mlir::Type eleTy,
 static mlir::Type getCoarrayHandleType(fir::FirOpBuilder &builder,
                                        mlir::Location loc) {
   // Defining the coarray handle type
-  std::string handleDTName =
-      fir::NameUniquer::doType({"prif"}, {}, 0, "prif_coarray_handle", {});
+  std::string handleDTName = fir::NameUniquer::doType(
+      {"__fortran_builtins"}, {}, 0, "__builtin_prif_coarray_handle_type", {});
   fir::RecordType handleTy =
       fir::RecordType::get(builder.getContext(), handleDTName);
-  mlir::Type infoTy =
-      fir::BoxType::get(fir::PointerType::get(builder.getNoneType()));
-  handleTy.finalize({}, {{"info", infoTy}});
-
-  // Checking if the type information was generated
-  fir::TypeInfoOp dt;
-  fir::RecordType parentType{};
-  mlir::OpBuilder::InsertPoint insertPointIfCreated;
-  std::tie(dt, insertPointIfCreated) =
-      builder.createTypeInfoOp(loc, handleTy, parentType);
-  if (insertPointIfCreated.isSet()) {
-    // fir.type_info wasn't built in a previous call.
-    dt->setAttr(dt.getNoInitAttrName(), builder.getUnitAttr());
-    dt->setAttr(dt.getNoDestroyAttrName(), builder.getUnitAttr());
-    dt->setAttr(dt.getNoFinalAttrName(), builder.getUnitAttr());
-    builder.restoreInsertionPoint(insertPointIfCreated);
-    // Create global op
-    // FIXME: replace handleTy by the Derived type that describe handleTy
-    std::string globalName =
-        fir::NameUniquer::getTypeDescriptorName(handleDTName);
-    auto linkage = builder.createLinkOnceODRLinkage();
-    builder.createGlobal(loc, handleTy, globalName, linkage);
-  }
+
+  std::string cPtrTypeName = fir::NameUniquer::doType(
+      {"__fortran_builtins"}, {}, 0, "__builtin_c_ptr", {});
+  fir::RecordType cPtrType =
+      fir::RecordType::get(builder.getContext(), cPtrTypeName);
+  cPtrType.finalize({}, {{"__c_ptr_c_address", builder.getI64Type()}});
+  handleTy.finalize({}, {{"info", cPtrType}});
   return handleTy;
 }
 
 mlir::Value getCoarrayHandle(fir::FirOpBuilder &builder, mlir::Location loc,
                              mlir::Value coarray) {
-  mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+  mlir::Type handleTy = getCoarrayHandleType(builder, loc);
   std::string uniqName = mif::getFullUniqName(coarray);
   if (!uniqName.empty()) {
     std::string globalName = uniqName + coarrayHandleSuffix.str();
     mlir::SymbolRefAttr symAttr =
         mlir::SymbolRefAttr::get(builder.getContext(), globalName);
-    mlir::Value coarrayHandle =
-        fir::AddrOfOp::create(builder, loc, builder.getRefType(boxTy), symAttr);
-    return fir::LoadOp::create(builder, loc, coarrayHandle);
+    mlir::Value coarrayHandle = fir::AddrOfOp::create(
+        builder, loc, builder.getRefType(handleTy), symAttr);
+    return coarrayHandle;
   }
   mlir::emitError(coarray.getLoc(),
                   "Unable to locate the coarray handle for this argument.");
@@ -113,27 +98,27 @@ mlir::Value getCoarrayHandle(fir::FirOpBuilder &builder, mlir::Location loc,
 // Storing the coarray descriptor as a global variable
 void storeCoarrayHandle(fir::FirOpBuilder &builder, mlir::Location loc,
                         mlir::Value coarrayHandle, std::string uniqName) {
+  mlir::Type handleTy = getCoarrayHandleType(builder, loc);
   std::string globalName = uniqName + coarrayHandleSuffix.str();
   fir::GlobalOp global = builder.getNamedGlobal(globalName);
   if (!global) {
-    global = builder.createGlobal(loc, coarrayHandle.getType(), globalName,
+    global = builder.createGlobal(loc, handleTy, globalName,
                                   builder.createLinkOnceLinkage());
     mlir::Region &region = global.getRegion();
     region.push_back(new mlir::Block);
     mlir::Block &block = region.back();
     auto insertPt = builder.saveInsertionPoint();
     builder.setInsertionPointToStart(&block);
-    auto box = fir::factory::createUnallocatedBox(builder, loc,
-                                                  coarrayHandle.getType(), {});
-    fir::HasValueOp::create(builder, loc, box);
+    mlir::Value zeroValue = fir::ZeroOp::create(builder, loc, handleTy);
+    fir::HasValueOp::create(builder, loc, zeroValue);
     builder.restoreInsertionPoint(insertPt);
   }
 
   mlir::SymbolRefAttr symAttr =
       mlir::SymbolRefAttr::get(builder.getContext(), globalName);
-  auto addrOf = fir::AddrOfOp::create(
-      builder, loc, builder.getRefType(coarrayHandle.getType()), symAttr);
-  fir::StoreOp::create(builder, loc, coarrayHandle, addrOf);
+  auto addrOf = fir::AddrOfOp::create(builder, loc,
+                                      builder.getRefType(handleTy), symAttr);
+  fir::CopyOp::create(builder, loc, coarrayHandle, addrOf);
 }
 
 std::int64_t getCorank(mlir::Value coarray) {
@@ -471,7 +456,6 @@ struct MIFThisImageOpConversion
 
     mlir::Type i64Ty = builder.getI64Type();
     mlir::Type i32Ty = builder.getI32Type();
-    mlir::Type boxTy = fir::BoxType::get(rewriter.getNoneType());
     mlir::Type refTy = builder.getRefType(rewriter.getNoneType());
 
     mlir::Value teamArg = op.getTeam();
@@ -492,7 +476,7 @@ struct MIFThisImageOpConversion
         result = builder.createTemporary(loc, i64Ty);
         ftype = mlir::FunctionType::get(builder.getContext(),
                                         /*inputs*/
-                                        {boxTy, builder.getRefType(i32Ty),
+                                        {refTy, builder.getRefType(i32Ty),
                                          refTy, builder.getRefType(i64Ty)},
                                         /*results*/ {});
         funcOp = builder.createFunction(
@@ -509,7 +493,7 @@ struct MIFThisImageOpConversion
         result = builder.createBox(loc, builder.createTemporary(loc, resTy));
         ftype = mlir::FunctionType::get(
             builder.getContext(),
-            /*inputs*/ {boxTy, refTy, fir::BoxType::get(resTy)},
+            /*inputs*/ {refTy, refTy, fir::BoxType::get(resTy)},
             /*results*/ {});
         funcOp = builder.createFunction(
             loc, getPRIFProcName("this_image_with_coarray"), ftype);
@@ -1104,20 +1088,19 @@ struct MIFAllocCoarrayOpConversion
 
     mlir::Type i64Ty = builder.getI64Type();
     mlir::Type ptrTy = fir::PointerType::get(builder.getNoneType());
-    mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+    mlir::Type refTy = builder.getRefType(builder.getNoneType());
     mlir::Type errmsgTy = getPRIFErrmsgType(builder);
     mlir::Type coboundsTy = genBoxedSequenceType(i64Ty);
     // Type of the procedure pointed by final_func will be the following :
     mlir::Type procTypePtr = fir::BoxProcType::get(
         builder.getContext(),
         mlir::FunctionType::get(builder.getContext(),
-                                {boxTy, getPRIFStatType(builder), errmsgTy},
+                                {refTy, getPRIFStatType(builder), errmsgTy},
                                 {}));
     mlir::FunctionType ftype = mlir::FunctionType::get(
         builder.getContext(),
         /*inputs*/
-        {coboundsTy, coboundsTy, builder.getRefType(i64Ty),
-         builder.getRefType(builder.getNoneType()), boxTy, ptrTy,
+        {coboundsTy, coboundsTy, builder.getRefType(i64Ty), refTy, refTy, ptrTy,
          getPRIFStatType(builder), errmsgTy, errmsgTy},
         /*results*/ {});
     mlir::func::FuncOp funcOp =
@@ -1131,8 +1114,7 @@ struct MIFAllocCoarrayOpConversion
     // Allocate instance of prif_coarray_handle type based on the PRIF
     // specification.
     mlir::Type handleTy = getCoarrayHandleType(builder, loc);
-    mlir::Value coarrayHandle =
-        builder.createBox(loc, builder.createTemporary(loc, handleTy));
+    mlir::Value coarrayHandle = builder.createTemporary(loc, handleTy);
 
     mlir::Value allocMem =
         fir::ConvertOp::create(builder, loc, ptrTy, op.getBox());
@@ -1175,11 +1157,11 @@ struct MIFDeallocCoarrayOpConversion
     mlir::Location loc = op.getLoc();
 
     mlir::Type errmsgTy = getPRIFErrmsgType(builder);
-    mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+    mlir::Type refTy = builder.getRefType(builder.getNoneType());
     mlir::FunctionType ftype = mlir::FunctionType::get(
         builder.getContext(),
         /*inputs*/
-        {boxTy, getPRIFStatType(builder), errmsgTy, errmsgTy},
+        {refTy, getPRIFStatType(builder), errmsgTy, errmsgTy},
         /*results*/ {});
     mlir::func::FuncOp funcOp = builder.createFunction(
         loc, getPRIFProcName("deallocate_coarray"), ftype);
@@ -1193,6 +1175,16 @@ struct MIFDeallocCoarrayOpConversion
     llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
         builder, loc, ftype, coarrayHandle, stat, errmsgArg, errmsgAllocArg);
     fir::CallOp callOp = fir::CallOp::create(builder, loc, funcOp, args);
+
+    // The coarray is deallocated in the coarray_handle but we need to
+    // set the address of the variable to null.
+    mlir::Type coarrayType = op.getCoarray().getType();
+    if (fir::isAllocatableType(coarrayType)) {
+      mlir::Value absent = fir::AbsentOp::create(builder, loc, coarrayType);
+      fir::runtime::genPointerAssociateScalar(builder, loc, op.getCoarray(),
+                                              absent);
+    }
+
     rewriter.replaceOp(op, callOp);
     return mlir::success();
   }
@@ -1209,11 +1201,11 @@ struct MIFCoshapeOpConversion : public mlir::OpRewritePattern<mif::CoshapeOp> {
     fir::FirOpBuilder builder(rewriter, mod);
     mlir::Location loc = op.getLoc();
     mlir::Type i64Ty = builder.getI64Type();
-    mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+    mlir::Type refTy = builder.getRefType(builder.getNoneType());
 
     mlir::FunctionType ftype =
         mlir::FunctionType::get(builder.getContext(),
-                                /*inputs*/ {boxTy, genBoxedSequenceType(i64Ty)},
+                                /*inputs*/ {refTy, genBoxedSequenceType(i64Ty)},
                                 /*results*/ {});
     mlir::func::FuncOp funcOp =
         builder.createFunction(loc, getPRIFProcName("coshape"), ftype);
@@ -1247,14 +1239,14 @@ mlir::LogicalResult CoboundOpConversion(T op, mlir::PatternRewriter &rewriter,
   fir::FirOpBuilder builder(rewriter, mod);
   mlir::Location loc = op.getLoc();
   mlir::Type i64Ty = builder.getI64Type();
-  mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+  mlir::Type refTy = builder.getRefType(builder.getNoneType());
 
   mlir::Value coarrayHandle = getCoarrayHandle(builder, loc, op.getCoarray());
   mlir::Type i32Ty = builder.getI32Type();
   mlir::FunctionType ftype = mlir::FunctionType::get(
       builder.getContext(),
       /*inputs*/
-      {boxTy, builder.getRefType(i32Ty), builder.getRefType(i64Ty)},
+      {refTy, builder.getRefType(i32Ty), builder.getRefType(i64Ty)},
       /*results*/ {});
   mlir::func::FuncOp funcOp =
       builder.createFunction(loc, getPRIFProcName(prefix + "_with_dim"), ftype);
@@ -1314,7 +1306,7 @@ struct MIFImageIndexOpConversion
     mlir::Type i64Ty = builder.getI64Type();
     mlir::Type i32Ty = builder.getI32Type();
     mlir::Type resTy = builder.getRefType(i32Ty);
-    mlir::Type boxTy = fir::BoxType::get(builder.getNoneType());
+    mlir::Type refTy = builder.getRefType(builder.getNoneType());
     mlir::Value result = builder.createTemporary(loc, i32Ty);
 
     mlir::func::FuncOp funcOp;
@@ -1323,7 +1315,7 @@ struct MIFImageIndexOpConversion
     if (!op.getTeam() && !op.getTeamNumber()) {
       mlir::FunctionType ftype = mlir::FunctionType::get(
           builder.getContext(),
-          /*inputs*/ {boxTy, genBoxedSequenceType(i64Ty), resTy},
+          /*inputs*/ {refTy, genBoxedSequenceType(i64Ty), resTy},
           /*results*/ {});
       funcOp =
           builder.createFunction(loc, getPRIFProcName("image_index"), ftype);
@@ -1343,7 +1335,7 @@ struct MIFImageIndexOpConversion
       }
       mlir::FunctionType ftype = mlir::FunctionType::get(
           builder.getContext(),
-          /*inputs*/ {boxTy, genBoxedSequenceType(i64Ty), teamTy, resTy},
+          /*inputs*/ {refTy, genBoxedSequenceType(i64Ty), teamTy, resTy},
           /*results*/ {});
       funcOp = builder.createFunction(loc, imageIndexName, ftype);
 
@@ -1364,8 +1356,7 @@ static void genCoarrayHandle(fir::FirOpBuilder &builder, mlir::ModuleOp mod,
 
   if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty)) {
     if (boxTy.isCoarray()) {
-      mlir::Type handleTy =
-          fir::BoxType::get(getCoarrayHandleType(builder, loc));
+      mlir::Type handleTy = getCoarrayHandleType(builder, loc);
       std::string globalName =
           op.getUniqName().str() + coarrayHandleSuffix.str();
       fir::GlobalOp global = builder.createGlobal(
@@ -1375,8 +1366,8 @@ static void genCoarrayHandle(fir::FirOpBuilder &builder, mlir::ModuleOp mod,
       mlir::Block &block = region.back();
       auto insertPt = builder.saveInsertionPoint();
       builder.setInsertionPointToStart(&block);
-      auto box = fir::factory::createUnallocatedBox(builder, loc, handleTy, {});
-      fir::HasValueOp::create(builder, loc, box);
+      mlir::Value zeroValue = fir::ZeroOp::create(builder, loc, handleTy);
+      fir::HasValueOp::create(builder, loc, zeroValue);
       builder.restoreInsertionPoint(insertPt);
     }
   }
diff --git a/flang/test/Fir/MIF/coarray-alloc.mlir b/flang/test/Fir/MIF/coarray-alloc.mlir
index a96bfc5935534..c32f80c8866b4 100644
--- a/flang/test/Fir/MIF/coarray-alloc.mlir
+++ b/flang/test/Fir/MIF/coarray-alloc.mlir
@@ -1,242 +1,264 @@
 // RUN: fir-opt --mif-convert %s | FileCheck %s
 
-  func.func @_QQmain() attributes {fir.bindc_name = "ALLOC_TEST"} {
-    %0 = fir.alloca !fir.array<1xi64>
-    %1 = fir.alloca !fir.array<1xi64>
-    %2 = fir.alloca !fir.array<1xi64>
-    %3 = fir.alloca !fir.array<1xi64>
-    %4 = fir.alloca !fir.array<3xi64>
-    %5 = fir.alloca !fir.array<3xi64>
-    %6 = fir.alloca !fir.array<2xi64>
-    %7 = fir.alloca !fir.array<2xi64>
-    %8 = fir.alloca !fir.array<1xi64>
-    %9 = fir.alloca !fir.array<1xi64>
-    %10 = fir.alloca !fir.array<3xi64>
-    %11 = fir.alloca !fir.array<3xi64>
-    %12 = fir.alloca !fir.array<2xi64>
-    %13 = fir.alloca !fir.array<2xi64>
-    %14 = fir.dummy_scope : !fir.dscope
-    %15 = fir.address_of(@_QFE.n.my_type2) : !fir.ref<!fir.char<1,8>>
-    %c8 = arith.constant 8 : index
-    %16:2 = hlfir.declare %15 typeparams %c8 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.my_type2"} : (!fir.ref<!fir.char<1,8>>, index) -> (!fir.ref<!fir.char<1,8>>, !fir.ref<!fir.char<1,8>>)
-    %17 = fir.address_of(@_QFE.n.co) : !fir.ref<!fir.char<1,2>>
-    %c2 = arith.constant 2 : index
-    %18:2 = hlfir.declare %17 typeparams %c2 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.co"} : (!fir.ref<!fir.char<1,2>>, index) -> (!fir.ref<!fir.char<1,2>>, !fir.ref<!fir.char<1,2>>)
-    %19 = fir.address_of(@_QFE.n.x) : !fir.ref<!fir.char<1>>
-    %c1 = arith.constant 1 : index
-    %20:2 = hlfir.declare %19 typeparams %c1 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.x"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
-    %21 = fir.address_of(@_QFE.n.y) : !fir.ref<!fir.char<1>>
-    %c1_0 = arith.constant 1 : index
-    %22:2 = hlfir.declare %21 typeparams %c1_0 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.y"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
-    %23 = fir.address_of(@_QFE.n.z) : !fir.ref<!fir.char<1>>
-    %c1_1 = arith.constant 1 : index
-    %24:2 = hlfir.declare %23 typeparams %c1_1 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.z"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
-    %25 = fir.address_of(@_QFE.n.my_type) : !fir.ref<!fir.char<1,7>>
-    %c7 = arith.constant 7 : index
-    %26:2 = hlfir.declare %25 typeparams %c7 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFE.n.my_type"} : (!fir.ref<!fir.char<1,7>>, index) -> (!fir.ref<!fir.char<1,7>>, !fir.ref<!fir.char<1,7>>)
-    %27 = fir.address_of(@_QFEa) : !fir.ref<i32>
-    %c1_i64 = arith.constant 1 : i64
-    %c0 = arith.constant 0 : index
-    %28 = fir.coordinate_of %13, %c0 : (!fir.ref<!fir.array<2xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64 to %28 : !fir.ref<i64>
-    %c1_i64_2 = arith.constant 1 : i64
-    %c1_3 = arith.constant 1 : index
-    %29 = fir.coordinate_of %13, %c1_3 : (!fir.ref<!fir.array<2xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64_2 to %29 : !fir.ref<i64>
-    %30 = fir.embox %13 : (!fir.ref<!fir.array<2xi64>>) -> !fir.box<!fir.array<2xi64>>
-    %c1_i64_4 = arith.constant 1 : i64
-    %c0_5 = arith.constant 0 : index
-    %31 = fir.coordinate_of %12, %c0_5 : (!fir.ref<!fir.array<2xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64_4 to %31 : !fir.ref<i64>
-    %c1_i64_6 = arith.constant 1 : i64
-    %c1_7 = arith.constant 1 : index
-    %32 = fir.coordinate_of %12, %c1_7 : (!fir.ref<!fir.array<2xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64_6 to %32 : !fir.ref<i64>
-    %33 = fir.embox %12 : (!fir.ref<!fir.array<2xi64>>) -> !fir.box<!fir.array<2xi64>>
-// CHECK: fir.call @_QMprifPprif_allocate_coarray({{.*}}) : (!fir.box<!fir.array<?xi64>>, !fir.box<!fir.array<?xi64>>, !fir.ref<i64>, !fir.ref<none>, !fir.box<none>, !fir.ptr<none>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
-    mif.alloc_coarray %27 lcobounds %30 ucobounds %33 {uniq_name = "_QFEa"} : (!fir.ref<i32>, !fir.box<!fir.array<2xi64>>, !fir.box<!fir.array<2xi64>>) -> ()
-    %34:2 = hlfir.declare %27 {uniq_name = "_QFEa"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-    %35 = fir.address_of(@_QFEa2) : !fir.ref<!fir.box<!fir.heap<i32>>>
-    %36:2 = hlfir.declare %35 {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFEa2"} : (!fir.ref<!fir.box<!fir.heap<i32>>>) -> (!fir.ref<!fir.box<!fir.heap<i32>>>, !fir.ref<!fir.box<!fir.heap<i32>>>)
-    %37 = fir.address_of(@_QFEb) : !fir.ref<f32>
-    %c3_i64 = arith.constant 3 : i64
-    %c0_8 = arith.constant 0 : index
-    %38 = fir.coordinate_of %11, %c0_8 : (!fir.ref<!fir.array<3xi64>>, index) -> !fir.ref<i64>
-    fir.store %c3_i64 to %38 : !fir.ref<i64>
-    %c1_i64_9 = arith.constant 1 : i64
-    %c1_10 = arith.constant 1 : index
-    %39 = fir.coordinate_of %11, %c1_10 : (!fir.ref<!fir.array<3xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64_9 to %39 : !fir.ref<i64>
-    %c1_i64_11 = arith.constant 1 : i64
-    %c2_12 = arith.constant 2 : index
-    %40 = fir.coordinate_of %11, %c2_12 : (!fir.ref<!fir.array<3xi64>>, index) -> !fir.ref<i64>
-    fir.store %c1_i64_11 to %40 : !fir.ref<i64>
-    %41 = fir.embox %11 : (!fir.ref<!fir.array<3xi64>>) -> !fir.box<!fir.array<3xi64>>
-    %c3_i64_13 = arith.constant 3 : i64
-    %c0_14 = arith.constant 0 : index
-    %42 = fir.coordinate_of %10, %c0_14 : (!fir.ref<!fir.array<3xi64>>, index) -> !fir.ref<i64>
-    fir.store %c3_i64_13 to %42 : !fir.ref<i64>
-    %c1_i64_15 = arith.constant 1 : i64
-  ...
[truncated]

``````````

</details>


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


More information about the flang-commits mailing list