[flang-commits] [flang] [flang] Characterize allocation based on MemAlloc effect instead of pattern matching (PR #166806)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Nov 6 16:01:22 PST 2025


================
@@ -80,8 +80,8 @@ def AnyRefOfConstantSizeAggregateType : TypeConstraint<
 // Memory SSA operations
 //===----------------------------------------------------------------------===//
 
-def fir_AllocaOp : fir_Op<"alloca", [AttrSizedOperandSegments,
-    MemoryEffects<[MemAlloc<AutomaticAllocationScopeResource>]>]> {
+def fir_AllocaOp : fir_Op<"alloca",
+    [AttrSizedOperandSegments, DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
----------------
vzakhari wrote:

Just FYI: if you can remove code in `fir::AllocaOp::getEffects` as I suggest below, then you can declare the `MemAlloc` effect in the operation definition like this: https://github.com/llvm/llvm-project/blob/32ebf635c2be171b01a288b00b3e64b8de72e61a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td#L249

This way you won't need to change the cpp files.

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


More information about the flang-commits mailing list