@@ -625,46 +625,6 @@ class BufferDeallocation : public BufferPlacementTransformationBase {
625
625
// BufferDeallocationPass
626
626
// ===----------------------------------------------------------------------===//
627
627
628
- struct DefaultAllocationInterface
629
- : public bufferization::AllocationOpInterface::ExternalModel<
630
- DefaultAllocationInterface, memref::AllocOp> {
631
- static std::optional<Operation *> buildDealloc (OpBuilder &builder,
632
- Value alloc) {
633
- return builder.create <memref::DeallocOp>(alloc.getLoc (), alloc)
634
- .getOperation ();
635
- }
636
- static std::optional<Value> buildClone (OpBuilder &builder, Value alloc) {
637
- return builder.create <bufferization::CloneOp>(alloc.getLoc (), alloc)
638
- .getResult ();
639
- }
640
- static ::mlir::HoistingKind getHoistingKind () {
641
- return HoistingKind::Loop | HoistingKind::Block;
642
- }
643
- static ::std::optional<::mlir::Operation *>
644
- buildPromotedAlloc (OpBuilder &builder, Value alloc) {
645
- Operation *definingOp = alloc.getDefiningOp ();
646
- return builder.create <memref::AllocaOp>(
647
- definingOp->getLoc (), cast<MemRefType>(definingOp->getResultTypes ()[0 ]),
648
- definingOp->getOperands (), definingOp->getAttrs ());
649
- }
650
- };
651
-
652
- struct DefaultAutomaticAllocationHoistingInterface
653
- : public bufferization::AllocationOpInterface::ExternalModel<
654
- DefaultAutomaticAllocationHoistingInterface, memref::AllocaOp> {
655
- static ::mlir::HoistingKind getHoistingKind () { return HoistingKind::Loop; }
656
- };
657
-
658
- struct DefaultReallocationInterface
659
- : public bufferization::AllocationOpInterface::ExternalModel<
660
- DefaultAllocationInterface, memref::ReallocOp> {
661
- static std::optional<Operation *> buildDealloc (OpBuilder &builder,
662
- Value realloc) {
663
- return builder.create <memref::DeallocOp>(realloc.getLoc (), realloc)
664
- .getOperation ();
665
- }
666
- };
667
-
668
628
// / The actual buffer deallocation pass that inserts and moves dealloc nodes
669
629
// / into the right positions. Furthermore, it inserts additional clones if
670
630
// / necessary. It uses the algorithm described at the top of the file.
@@ -725,16 +685,6 @@ LogicalResult bufferization::deallocateBuffers(Operation *op) {
725
685
return success ();
726
686
}
727
687
728
- void bufferization::registerAllocationOpInterfaceExternalModels (
729
- DialectRegistry ®istry) {
730
- registry.addExtension (+[](MLIRContext *ctx, memref::MemRefDialect *dialect) {
731
- memref::AllocOp::attachInterface<DefaultAllocationInterface>(*ctx);
732
- memref::AllocaOp::attachInterface<
733
- DefaultAutomaticAllocationHoistingInterface>(*ctx);
734
- memref::ReallocOp::attachInterface<DefaultReallocationInterface>(*ctx);
735
- });
736
- }
737
-
738
688
// ===----------------------------------------------------------------------===//
739
689
// BufferDeallocationPass construction
740
690
// ===----------------------------------------------------------------------===//
0 commit comments