[flang-commits] [flang] [flang][Lower] Add Lowering for CO_{BROADCAST, MAX, MIN, SUM} to PRIF (PR #154770)

Jean-Didier PAILLEUX via flang-commits flang-commits at lists.llvm.org
Fri Aug 22 05:42:50 PDT 2025


================
@@ -3649,6 +3677,86 @@ mlir::Value IntrinsicLibrary::genCmplx(mlir::Type resultType,
                                                            imag);
 }
 
+// CO_BROADCAST
+void IntrinsicLibrary::genCoBroadcast(llvm::ArrayRef<fir::ExtendedValue> args) {
+  checkCoarrayEnabled();
+  assert(args.size() == 4);
+  mlir::Value refNone =
+      builder
+          .create<fir::AbsentOp>(loc, builder.getRefType(builder.getI32Type()))
+          .getResult();
+  mlir::Value sourceImage =
+      isStaticallyAbsent(args[1]) ? refNone : fir::getBase(args[1]);
----------------
JDPailleux wrote:

Even if the argument is intent(in), Fortran still passes scalars by reference.

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


More information about the flang-commits mailing list