[flang-commits] [flang] [flang][stack-arrays] Extend pass to work on declare ops and within omp regions (PR #98810)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jul 16 03:46:31 PDT 2024


================
@@ -361,6 +361,13 @@ void AllocationAnalysis::visitOperation(mlir::Operation *op,
   } else if (mlir::isa<fir::FreeMemOp>(op)) {
     assert(op->getNumOperands() == 1 && "fir.freemem has one operand");
     mlir::Value operand = op->getOperand(0);
+
+    // Note: StackArrays is scheduled in the pass pipeline after lowering hlfir
+    // to fir. Therefore, we only need to handle `fir::DeclareOp`s.
+    if (auto declareOp =
----------------
tblah wrote:

I agree this is fine and a lot simpler than tracking both references to the `allocated` variable

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


More information about the flang-commits mailing list