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

Jeff Niu via flang-commits flang-commits at lists.llvm.org
Mon Jul 15 14:18:07 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 =
----------------
Mogball wrote:

I don't have the context on the `fir` dialect to comment on the memory effects model here, but what I can say is this *should* be fine. What you want is if the allocation state of the result of `declareOp` is modified, that this function gets re-invoked on the right user, which the DFA framework should ensure happens properly.

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


More information about the flang-commits mailing list