//===- TestDeadCodeAnalysis.cpp - Test dead code analysis -----------------===// // // 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 // //===----------------------------------------------------------------------===// #include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h" #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h" #include "mlir/IR/Matchers.h" #include "mlir/Pass/Pass.h" usingnamespacemlir; usingnamespacemlir::dataflow; /// Print the liveness of every block, control-flow edge, and the predecessors /// of all regions, callables, and calls. static void printAnalysisResults(DataFlowSolver &solver, Operation *op, raw_ostream &os) { … } namespace { /// This is a simple analysis that implements a transfer function for constant /// operations. struct ConstantAnalysis : public DataFlowAnalysis { … }; /// This is a simple pass that runs dead code analysis with a constant value /// provider that only understands constant operations. struct TestDeadCodeAnalysisPass : public PassWrapper<TestDeadCodeAnalysisPass, OperationPass<>> { … }; } // end anonymous namespace namespace mlir { namespace test { void registerTestDeadCodeAnalysisPass() { … } } // end namespace test } // end namespace mlir