@@ -80,8 +80,10 @@ def AnyRefOfConstantSizeAggregateType : TypeConstraint<
8080// Memory SSA operations
8181//===----------------------------------------------------------------------===//
8282
83- def fir_AllocaOp : fir_Op<"alloca",
84- [AttrSizedOperandSegments, DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
83+ def fir_AllocaOp
84+ : fir_Op<"alloca",
85+ [AttrSizedOperandSegments,
86+ MemoryEffects<[MemAlloc<AutomaticAllocationScopeResource>]>]> {
8587 let summary = "allocate storage for a temporary on the stack given a type";
8688 let description = [{
8789 This primitive operation is used to allocate an object on the stack. A
@@ -162,7 +164,9 @@ def fir_AllocaOp : fir_Op<"alloca",
162164 Variadic<AnyIntegerType>:$shape
163165 );
164166
165- let results = (outs fir_ReferenceType);
167+ let results =
168+ (outs Res<fir_ReferenceType,
169+ "", [MemAlloc<AutomaticAllocationScopeResource>]>:$res);
166170
167171 let hasCustomAssemblyFormat = 1;
168172 let hasVerifier = 1;
@@ -212,8 +216,9 @@ def fir_AllocaOp : fir_Op<"alloca",
212216 }];
213217}
214218
215- def fir_AllocMemOp : fir_Op<"allocmem",
216- [DeclareOpInterfaceMethods<MemoryEffectsOpInterface>, AttrSizedOperandSegments]> {
219+ def fir_AllocMemOp
220+ : fir_Op<"allocmem", [AttrSizedOperandSegments,
221+ MemoryEffects<[MemAlloc<DefaultResource>]>]> {
217222 let summary = "allocate storage on the heap for an object of a given type";
218223
219224 let description = [{
@@ -235,7 +240,7 @@ def fir_AllocMemOp : fir_Op<"allocmem",
235240 Variadic<AnyIntegerType>:$typeparams,
236241 Variadic<AnyIntegerType>:$shape
237242 );
238- let results = (outs fir_HeapType);
243+ let results = (outs Res< fir_HeapType, "", [MemAlloc<DefaultResource>]>:$res );
239244
240245 let hasCustomAssemblyFormat = 1;
241246 let hasVerifier = 1;
0 commit comments