MLIR
18.0.0git
|
Dead code analysis analyzes control-flow, as understood by RegionBranchOpInterface
and BranchOpInterface
, and the callgraph, as understood by CallableOpInterface
and CallOpInterface
.
More...
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
Public Member Functions | |
DeadCodeAnalysis (DataFlowSolver &solver) | |
LogicalResult | initialize (Operation *top) override |
Initialize the analysis by visiting every operation with potential control-flow semantics. More... | |
LogicalResult | visit (ProgramPoint point) override |
Visit an operation with control-flow semantics and deduce which of its successors are live. More... | |
![]() | |
virtual | ~DataFlowAnalysis () |
DataFlowAnalysis (DataFlowSolver &solver) | |
Create an analysis with a reference to the parent solver. More... | |
Additional Inherited Members | |
![]() | |
void | addDependency (AnalysisState *state, ProgramPoint point) |
Create a dependency between the given analysis state and program point on this analysis. More... | |
void | propagateIfChanged (AnalysisState *state, ChangeResult changed) |
Propagate an update to a state if it changed. More... | |
template<typename PointT > | |
void | registerPointKind () |
Register a custom program point class. More... | |
template<typename PointT , typename... Args> | |
PointT * | getProgramPoint (Args &&...args) |
Get or create a custom program point. More... | |
template<typename StateT , typename PointT > | |
StateT * | getOrCreate (PointT point) |
Get the analysis state associated with the program point. More... | |
template<typename StateT , typename PointT > | |
const StateT * | getOrCreateFor (ProgramPoint dependent, PointT point) |
Get a read-only analysis state for the given point and create a dependency on dependent . More... | |
Dead code analysis analyzes control-flow, as understood by RegionBranchOpInterface
and BranchOpInterface
, and the callgraph, as understood by CallableOpInterface
and CallOpInterface
.
This analysis uses known constant values of operands to determine the liveness of each block and each edge between a block and its predecessors. For region control-flow, this analysis determines the predecessor operations for region entry blocks and region control-flow operations. For the callgraph, this analysis determines the callsites and live returns of every function.
Definition at line 175 of file DeadCodeAnalysis.h.
|
explicit |
Definition at line 116 of file DeadCodeAnalysis.cpp.
|
overridevirtual |
Initialize the analysis by visiting every operation with potential control-flow semantics.
Implements mlir::DataFlowAnalysis.
Definition at line 121 of file DeadCodeAnalysis.cpp.
References mlir::Operation::getRegions().
|
overridevirtual |
Visit an operation with control-flow semantics and deduce which of its successors are live.
Implements mlir::DataFlowAnalysis.
Definition at line 235 of file DeadCodeAnalysis.cpp.
References mlir::success().