diff --git a/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h --- a/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h +++ b/mlir/include/mlir/Analysis/DataFlow/DenseAnalysis.h @@ -93,16 +93,11 @@ propagateIfChanged(lhs, lhs->join(rhs)); } -private: /// Visit an operation. If this is a call operation or region control-flow /// operation, then the state after the execution of the operation is set by /// control-flow or the callgraph. Otherwise, this function invokes the /// operation transfer function. - void visitOperation(Operation *op); - - /// Visit a block. The state at the start of the block is propagated from - /// control-flow predecessors or callsites - void visitBlock(Block *block); + virtual void processOperation(Operation *op); /// Visit a program point within a region branch operation with predecessors /// in it. This can either be an entry block of one of the regions of the @@ -110,6 +105,11 @@ void visitRegionBranchOperation(ProgramPoint point, RegionBranchOpInterface branch, AbstractDenseLattice *after); + +private: + /// Visit a block. The state at the start of the block is propagated from + /// control-flow predecessors or callsites + void visitBlock(Block *block); }; //===----------------------------------------------------------------------===// @@ -148,7 +148,6 @@ setToEntryState(static_cast(lattice)); } -private: /// Type-erased wrappers that convert the abstract dense lattice to a derived /// lattice and invoke the virtual hooks operating on the derived lattice. void visitOperationImpl(Operation *op, const AbstractDenseLattice &before, diff --git a/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp --- a/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp @@ -20,7 +20,7 @@ LogicalResult AbstractDenseDataFlowAnalysis::initialize(Operation *top) { // Visit every operation and block. - visitOperation(top); + processOperation(top); for (Region ®ion : top->getRegions()) { for (Block &block : region) { visitBlock(&block); @@ -34,7 +34,7 @@ LogicalResult AbstractDenseDataFlowAnalysis::visit(ProgramPoint point) { if (auto *op = point.dyn_cast()) - visitOperation(op); + processOperation(op); else if (auto *block = point.dyn_cast()) visitBlock(block); else @@ -42,7 +42,7 @@ return success(); } -void AbstractDenseDataFlowAnalysis::visitOperation(Operation *op) { +void AbstractDenseDataFlowAnalysis::processOperation(Operation *op) { // If the containing block is not executable, bail out. if (!getOrCreateFor(op, op->getBlock())->isLive()) return;