MLIR  20.0.0git
Public Member Functions | List of all members
mlir::dataflow::IntegerRangeAnalysis Class Reference

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"

+ Inheritance diagram for mlir::dataflow::IntegerRangeAnalysis:

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 >
IntegerValueRangeLatticegetLatticeElement (Value value) override
 Get the lattice element for a value. More...
 
const IntegerValueRangeLatticegetLatticeElementFor (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 AbstractSparseLatticegetLatticeElementFor (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...
 
ProgramPointgetProgramPointBefore (Operation *op)
 Get a uniqued program point instance. More...
 
ProgramPointgetProgramPointBefore (Block *block)
 
ProgramPointgetProgramPointAfter (Operation *op)
 
ProgramPointgetProgramPointAfter (Block *block)
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. More...
 

Detailed Description

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.

Member Function Documentation

◆ setToEntryState()

void mlir::dataflow::IntegerRangeAnalysis::setToEntryState ( IntegerValueRangeLattice lattice)
inlineoverridevirtual

◆ SparseForwardDataFlowAnalysis()

Definition at line 280 of file SparseAnalysis.h.

◆ visitNonControlFlowArguments()

void IntegerRangeAnalysis::visitNonControlFlowArguments ( Operation op,
const RegionSuccessor successor,
ArrayRef< IntegerValueRangeLattice * >  argLattices,
unsigned  firstIndex 
)
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().

◆ visitOperation()

LogicalResult IntegerRangeAnalysis::visitOperation ( Operation op,
ArrayRef< const IntegerValueRangeLattice * >  operands,
ArrayRef< IntegerValueRangeLattice * >  results 
)
overridevirtual

The documentation for this class was generated from the following files: