Skip to content

Commit d807d66

Browse files
committed
remove getEffects
1 parent a37b956 commit d807d66

File tree

2 files changed

+11
-34
lines changed

2 files changed

+11
-34
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

flang/lib/Optimizer/Dialect/FIROps.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,6 @@ llvm::LogicalResult fir::AllocaOp::verify() {
285285
return mlir::success();
286286
}
287287

288-
void fir::AllocaOp::getEffects(
289-
llvm::SmallVectorImpl<
290-
mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect>>
291-
&effects) {
292-
// Value-scoped Allocate for AA.
293-
effects.emplace_back(
294-
mlir::MemoryEffects::Allocate::get(),
295-
mlir::cast<mlir::OpResult>(getOperation()->getResult(0)),
296-
mlir::SideEffects::AutomaticAllocationScopeResource::get());
297-
// Preserve previous behavior: op-scoped Allocate for passes relying on it.
298-
effects.emplace_back(
299-
mlir::MemoryEffects::Allocate::get(),
300-
mlir::SideEffects::AutomaticAllocationScopeResource::get());
301-
}
302-
303288
bool fir::AllocaOp::ownsNestedAlloca(mlir::Operation *op) {
304289
return op->hasTrait<mlir::OpTrait::IsIsolatedFromAbove>() ||
305290
op->hasTrait<mlir::OpTrait::AutomaticAllocationScope>() ||
@@ -399,19 +384,6 @@ llvm::LogicalResult fir::AllocMemOp::verify() {
399384
return mlir::success();
400385
}
401386

402-
void fir::AllocMemOp::getEffects(
403-
llvm::SmallVectorImpl<
404-
mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect>>
405-
&effects) {
406-
// Value-scoped Allocate for AA.
407-
effects.emplace_back(mlir::MemoryEffects::Allocate::get(),
408-
mlir::cast<mlir::OpResult>(getOperation()->getResult(0)),
409-
mlir::SideEffects::DefaultResource::get());
410-
// Preserve previous behavior: op-scoped Allocate for passes relying on it.
411-
effects.emplace_back(mlir::MemoryEffects::Allocate::get(),
412-
mlir::SideEffects::DefaultResource::get());
413-
}
414-
415387
//===----------------------------------------------------------------------===//
416388
// ArrayCoorOp
417389
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)