MLIR
20.0.0git
|
Integer range analysis determines the integer value range of SSA values using operations that define InferIntRangeInterface
and also sets the range of iteration indices of loops with known bounds.
More...
#include "mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
Public Member Functions | |
void | setToEntryState (IntegerValueRangeLattice *lattice) override |
At an entry point, we cannot reason about interger value ranges. More... | |
LogicalResult | visitOperation (Operation *op, ArrayRef< const IntegerValueRangeLattice * > operands, ArrayRef< IntegerValueRangeLattice * > results) override |
Visit an operation. More... | |
void | visitNonControlFlowArguments (Operation *op, const RegionSuccessor &successor, ArrayRef< IntegerValueRangeLattice * > argLattices, unsigned firstIndex) override |
Visit block arguments or operation results of an operation with region control-flow for which values are not defined by region control-flow. More... | |
SparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
Public Member Functions inherited from mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice > | |
SparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
virtual void | visitExternalCall (CallOpInterface call, ArrayRef< const IntegerValueRangeLattice * > argumentLattices, ArrayRef< IntegerValueRangeLattice * > resultLattices) |
Visit a call operation to an externally defined function given the lattices of its arguments. More... | |
Public Member Functions inherited from mlir::dataflow::AbstractSparseForwardDataFlowAnalysis | |
LogicalResult | initialize (Operation *top) override |
Initialize the analysis by visiting every owner of an SSA value: all operations and blocks. More... | |
LogicalResult | visit (ProgramPoint *point) override |
Visit a program point. More... | |
Public Member Functions inherited from mlir::DataFlowAnalysis | |
virtual | ~DataFlowAnalysis () |
DataFlowAnalysis (DataFlowSolver &solver) | |
Create an analysis with a reference to the parent solver. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice > | |
IntegerValueRangeLattice * | getLatticeElement (Value value) override |
Get the lattice element for a value. More... | |
const IntegerValueRangeLattice * | getLatticeElementFor (ProgramPoint *point, Value value) |
Get the lattice element for a value and create a dependency on the provided program point. More... | |
void | setAllToEntryStates (ArrayRef< IntegerValueRangeLattice * > lattices) |
Protected Member Functions inherited from mlir::dataflow::AbstractSparseForwardDataFlowAnalysis | |
AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
const AbstractSparseLattice * | getLatticeElementFor (ProgramPoint *point, Value value) |
Get a read-only lattice element for a value and add it as a dependency to a program point. More... | |
void | setAllToEntryStates (ArrayRef< AbstractSparseLattice * > lattices) |
void | join (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs) |
Join the lattice element and propagate and update if it changed. More... | |
Protected Member Functions inherited from mlir::DataFlowAnalysis | |
void | addDependency (AnalysisState *state, ProgramPoint *point) |
Create a dependency between the given analysis state and lattice anchor on this analysis. More... | |
void | propagateIfChanged (AnalysisState *state, ChangeResult changed) |
Propagate an update to a state if it changed. More... | |
template<typename AnchorT > | |
void | registerAnchorKind () |
Register a custom lattice anchor class. More... | |
template<typename AnchorT , typename... Args> | |
AnchorT * | getLatticeAnchor (Args &&...args) |
Get or create a custom lattice anchor. More... | |
template<typename StateT , typename AnchorT > | |
StateT * | getOrCreate (AnchorT anchor) |
Get the analysis state associated with the lattice anchor. More... | |
template<typename StateT , typename AnchorT > | |
const StateT * | getOrCreateFor (ProgramPoint *dependent, AnchorT anchor) |
Get a read-only analysis state for the given point and create a dependency on dependent . More... | |
ProgramPoint * | getProgramPointBefore (Operation *op) |
Get a uniqued program point instance. More... | |
ProgramPoint * | getProgramPointBefore (Block *block) |
ProgramPoint * | getProgramPointAfter (Operation *op) |
ProgramPoint * | getProgramPointAfter (Block *block) |
const DataFlowConfig & | getSolverConfig () const |
Return the configuration of the solver used for this analysis. More... | |
Integer range analysis determines the integer value range of SSA values using operations that define InferIntRangeInterface
and also sets the range of iteration indices of loops with known bounds.
This analysis depends on DeadCodeAnalysis, and will be a silent no-op if DeadCodeAnalysis is not loaded in the same solver context.
Definition at line 45 of file IntegerRangeAnalysis.h.
|
inlineoverridevirtual |
At an entry point, we cannot reason about interger value ranges.
Implements mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >.
Definition at line 51 of file IntegerRangeAnalysis.h.
References mlir::dataflow::Lattice< ValueT >::getAnchor(), mlir::IntegerValueRange::getMaxRange(), mlir::dataflow::Lattice< ValueT >::join(), and mlir::DataFlowAnalysis::propagateIfChanged().
|
inlineexplicit |
Definition at line 280 of file SparseAnalysis.h.
|
overridevirtual |
Visit block arguments or operation results of an operation with region control-flow for which values are not defined by region control-flow.
This function calls InferIntRangeInterface
to provide values for block arguments or tries to reduce the range on loop induction variables with known bounds.
Given the results of getConstant{Lower,Upper}Bound() or getConstantStep() on a LoopLikeInterface return the lower/upper bound for that result if possible.
Reimplemented from mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >.
Definition at line 109 of file IntegerRangeAnalysis.cpp.
References mlir::ConstantIntRanges::fromSigned(), mlir::Region::getArguments(), mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >::getLatticeElement(), mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >::getLatticeElementFor(), mlir::IntegerValueRange::getMaxRange(), mlir::Operation::getOperands(), mlir::DataFlowAnalysis::getProgramPointAfter(), mlir::ConstantIntRanges::getStorageBitwidth(), mlir::RegionSuccessor::getSuccessor(), mlir::Value::getUsers(), mlir::dataflow::Lattice< ValueT >::getValue(), mlir::IntegerValueRange::getValue(), mlir::IntegerValueRange::isUninitialized(), mlir::dataflow::Lattice< ValueT >::join(), max(), min(), mlir::DataFlowAnalysis::propagateIfChanged(), mlir::ConstantIntRanges::smax(), mlir::ConstantIntRanges::smin(), and mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitNonControlFlowArguments().
|
overridevirtual |
Visit an operation.
Invoke the transfer function on each operation that implements InferIntRangeInterface
.
Implements mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >.
Definition at line 63 of file IntegerRangeAnalysis.cpp.
References mlir::IntegerValueRange::getMaxRange(), mlir::Operation::getResults(), mlir::Value::getUsers(), mlir::dataflow::Lattice< ValueT >::getValue(), mlir::IntegerValueRange::isUninitialized(), mlir::dataflow::Lattice< ValueT >::join(), mlir::DataFlowAnalysis::propagateIfChanged(), and mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >::setAllToEntryStates().