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) {
463
463
match.array = match.assign .getLhs ();
464
464
mlir::Type arrayType = mlir::dyn_cast<fir::SequenceType>(
465
465
fir::unwrapPassByRefType (match.array .getType ()));
466
- if (!arrayType)
466
+ if (!arrayType) {
467
+ LLVM_DEBUG (llvm::dbgs () << " AssignOp's result is not an array\n " );
467
468
return std::nullopt;
469
+ }
468
470
469
471
// require that the array elements are trivial
470
472
// TODO: this is just to make the pass easier to think about. Not an inherent
471
473
// limitation
472
474
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 " );
474
477
return std::nullopt;
478
+ }
475
479
476
480
// The array must have the same shape as the elemental.
477
481
//
@@ -485,8 +489,10 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
485
489
// there is no reallocation of the lhs due to the assignment.
486
490
// We can probably try generating multiple versions of the code
487
491
// 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 " );
489
494
return std::nullopt;
495
+ }
490
496
491
497
// the transformation wants to apply the elemental in a do-loop at the
492
498
// hlfir.assign, check there are no effects which make this unsafe
You can’t perform that action at this time.
0 commit comments