[flang-commits] [flang] [flang][OpenMP] Support reduction of allocatable variables (PR #88392)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Apr 17 06:08:58 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)
----------------
tblah wrote:
Yes. Previously any box not containing an array (or containing an array with unknown shape) would have hit that TODO. Now We allow boxes containing a heap pointer, even if it doesn't wrap an array.
This is so that we can support trivial-typed scalar allocatable reduction variables, which seem to always be boxed.
https://github.com/llvm/llvm-project/pull/88392
More information about the flang-commits
mailing list