[flang-commits] [flang] [flang][OpenMP] Support reduction of allocatable variables (PR #88392)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Apr 15 04:13:28 PDT 2024


================
@@ -301,17 +301,35 @@ static void genBoxCombiner(fir::FirOpBuilder &builder, mlir::Location loc,
                            ReductionProcessor::ReductionIdentifier redId,
                            fir::BaseBoxType boxTy, mlir::Value lhs,
                            mlir::Value rhs) {
-  fir::SequenceType seqTy =
-      mlir::dyn_cast_or_null<fir::SequenceType>(boxTy.getEleTy());
-  // TODO: support allocatable arrays: !fir.box<!fir.heap<!fir.array<...>>>
-  if (!seqTy || seqTy.hasUnknownShape())
+  fir::SequenceType seqTy = mlir::dyn_cast_or_null<fir::SequenceType>(
+      fir::unwrapRefType(boxTy.getEleTy()));
+  fir::HeapType heapTy =
+      mlir::dyn_cast_or_null<fir::HeapType>(boxTy.getEleTy());
+  if ((!seqTy || seqTy.hasUnknownShape()) && !heapTy)
----------------
kiranchandramohan wrote:

Would this check (!heapTy) affect other kinds of boxes?

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


More information about the flang-commits mailing list