File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
flang/lib/Optimizer/HLFIR/Transforms Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -463,15 +463,19 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
463463 match.array = match.assign .getLhs ();
464464 mlir::Type arrayType = mlir::dyn_cast<fir::SequenceType>(
465465 fir::unwrapPassByRefType (match.array .getType ()));
466- if (!arrayType)
466+ if (!arrayType) {
467+ LLVM_DEBUG (llvm::dbgs () << " AssignOp's result is not an array\n " );
467468 return std::nullopt ;
469+ }
468470
469471 // require that the array elements are trivial
470472 // TODO: this is just to make the pass easier to think about. Not an inherent
471473 // limitation
472474 mlir::Type eleTy = hlfir::getFortranElementType (arrayType);
473- if (!fir::isa_trivial (eleTy))
475+ if (!fir::isa_trivial (eleTy)) {
476+ LLVM_DEBUG (llvm::dbgs () << " AssignOp's data type is not trivial\n " );
474477 return std::nullopt ;
478+ }
475479
476480 // The array must have the same shape as the elemental.
477481 //
@@ -485,8 +489,10 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
485489 // there is no reallocation of the lhs due to the assignment.
486490 // We can probably try generating multiple versions of the code
487491 // with checking for the shape match, length parameters match, etc.
488- if (match.assign .getRealloc ())
492+ if (match.assign .isAllocatableAssignment ()) {
493+ LLVM_DEBUG (llvm::dbgs () << " AssignOp may involve (re)allocation of LHS\n " );
489494 return std::nullopt ;
495+ }
490496
491497 // the transformation wants to apply the elemental in a do-loop at the
492498 // hlfir.assign, check there are no effects which make this unsafe
You can’t perform that action at this time.
0 commit comments