[flang-commits] [flang] 0b442bc - [flang][NFC] Added debug output to opt-bufferization pass. (#119936)
via flang-commits
flang-commits at lists.llvm.org
Mon Dec 16 12:58:25 PST 2024
Author: Slava Zakharin
Date: 2024-12-16T12:58:22-08:00
New Revision: 0b442bc51631552ab8a249485dd81b5c83cf5a5d
URL: https://github.com/llvm/llvm-project/commit/0b442bc51631552ab8a249485dd81b5c83cf5a5d
DIFF: https://github.com/llvm/llvm-project/commit/0b442bc51631552ab8a249485dd81b5c83cf5a5d.diff
LOG: [flang][NFC] Added debug output to opt-bufferization pass. (#119936)
Added:
Modified:
flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
index 8342458e00763c..c152c27c0a05b7 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
@@ -463,15 +463,19 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
match.array = match.assign.getLhs();
mlir::Type arrayType = mlir::dyn_cast<fir::SequenceType>(
fir::unwrapPassByRefType(match.array.getType()));
- if (!arrayType)
+ if (!arrayType) {
+ LLVM_DEBUG(llvm::dbgs() << "AssignOp's result is not an array\n");
return std::nullopt;
+ }
// require that the array elements are trivial
// TODO: this is just to make the pass easier to think about. Not an inherent
// limitation
mlir::Type eleTy = hlfir::getFortranElementType(arrayType);
- if (!fir::isa_trivial(eleTy))
+ if (!fir::isa_trivial(eleTy)) {
+ LLVM_DEBUG(llvm::dbgs() << "AssignOp's data type is not trivial\n");
return std::nullopt;
+ }
// The array must have the same shape as the elemental.
//
@@ -485,8 +489,10 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
// there is no reallocation of the lhs due to the assignment.
// We can probably try generating multiple versions of the code
// with checking for the shape match, length parameters match, etc.
- if (match.assign.getRealloc())
+ if (match.assign.isAllocatableAssignment()) {
+ LLVM_DEBUG(llvm::dbgs() << "AssignOp may involve (re)allocation of LHS\n");
return std::nullopt;
+ }
// the transformation wants to apply the elemental in a do-loop at the
// hlfir.assign, check there are no effects which make this unsafe
More information about the flang-commits
mailing list