MLIR-AIE 1.4.5.dev
AIEObjectFifoErasePools.cpp
Go to the documentation of this file.
1//===- AIEObjectFifoErasePools.cpp ------------------------------*- C++ -*-===//
2//
3// Copyright (C) 2026 Advanced Micro Devices, Inc.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5//
6//===----------------------------------------------------------------------===//
7
10
11#include "mlir/Pass/Pass.h"
12
13using namespace mlir;
14using namespace xilinx;
15using namespace xilinx::AIE;
16
17namespace xilinx::AIE {
18#define GEN_PASS_DEF_AIEOBJECTFIFOERASEPOOLS
19#include "aie/Dialect/AIE/Transforms/AIEPasses.h.inc"
20} // namespace xilinx::AIE
21
22namespace {
23
24struct AIEObjectFifoErasePoolsPass
25 : public xilinx::AIE::impl::AIEObjectFifoErasePoolsBase<
26 AIEObjectFifoErasePoolsPass> {
27
28 void runOnOperation() override {
29 DeviceOp device = getOperation();
30
31 // Pool users are open-ended because any symbol user may retain the pool.
32 SymbolTableCollection symbolTables;
33 SymbolUserMap users(symbolTables, device);
34
35 for (auto pool :
36 llvm::make_early_inc_range(device.getOps<ObjectFifoPoolOp>())) {
37 if (users.getUsers(pool).empty()) {
38 pool.erase();
39 }
40 }
41 }
42};
43
44} // namespace
45
46std::unique_ptr<OperationPass<DeviceOp>>
48 return std::make_unique<AIEObjectFifoErasePoolsPass>();
49}
std::unique_ptr< mlir::OperationPass< DeviceOp > > createAIEObjectFifoErasePoolsPass()