[flang-commits] [flang] [Flang][MIF] Adding support of intrinsics with coarray argument (PR #192944)

via flang-commits flang-commits at lists.llvm.org
Thu Jun 4 06:51:08 PDT 2026


================
@@ -154,8 +154,17 @@ inline bool conformsWithPassByRef(mlir::Type t) {
   return isa_ref_type(t) || isa_box_type(t) || mlir::isa<mlir::FunctionType>(t);
 }
 
+/// Unwrap a coarray type by returning the element type.
+/// e.g.,
+///   !fir.coarray<T, N>  ->  T
+/// otherwise
+///   T -> T
+mlir::Type unwrapCoarrayType(mlir::Type ty);
+
 /// Is `t` a derived (record) type?
-inline bool isa_derived(mlir::Type t) { return mlir::isa<fir::RecordType>(t); }
+inline bool isa_derived(mlir::Type t) {
+  return mlir::isa<fir::RecordType>(fir::unwrapCoarrayType(t));
----------------
jeanPerier wrote:

I do not think this is the right change here, most code actually expect to find simple SSA types when calling those helpers.
I see why you could justify that change, but it is weird that a coarray would not need to be unwrapped here but a fir.array needs to be unwrapped.

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


More information about the flang-commits mailing list