//===- SymbolDCE.cpp - Pass to delete dead symbols ------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements an algorithm for eliminating symbol operations that are // known to be dead. // //===----------------------------------------------------------------------===// #include "mlir/Transforms/Passes.h" #include "mlir/IR/SymbolTable.h" namespace mlir { #define GEN_PASS_DEF_SYMBOLDCE #include "mlir/Transforms/Passes.h.inc" } // namespace mlir usingnamespacemlir; namespace { struct SymbolDCE : public impl::SymbolDCEBase<SymbolDCE> { … }; } // namespace void SymbolDCE::runOnOperation() { … } /// Compute the liveness of the symbols within the given symbol table. /// `symbolTableIsHidden` is true if this symbol table is known to be /// unaccessible from operations in its parent regions. LogicalResult SymbolDCE::computeLiveness(Operation *symbolTableOp, SymbolTableCollection &symbolTable, bool symbolTableIsHidden, DenseSet<Operation *> &liveSymbols) { … } std::unique_ptr<Pass> mlir::createSymbolDCEPass() { … }