Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "mlir/Interfaces/InferIntRangeInterface.h"

namespace mlir {
class RewriterBase;
namespace dataflow {

/// This lattice element represents the integer value range of an SSA value.
Expand Down Expand Up @@ -83,6 +84,9 @@ LogicalResult staticallyNonNegative(DataFlowSolver &solver, Operation *op);
/// to use a non-64-bit index.
LogicalResult staticallyNonNegative(DataFlowSolver &solver, Value v);

LogicalResult maybeReplaceWithConstant(DataFlowSolver &solver,
RewriterBase &rewriter, Value value);

} // end namespace dataflow
} // end namespace mlir

Expand Down
7 changes: 4 additions & 3 deletions mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ static void copyIntegerRange(DataFlowSolver &solver, Value oldVal,
*oldState);
}

namespace mlir::dataflow {
/// Patterned after SCCP
static LogicalResult maybeReplaceWithConstant(DataFlowSolver &solver,
PatternRewriter &rewriter,
Value value) {
LogicalResult maybeReplaceWithConstant(DataFlowSolver &solver,
RewriterBase &rewriter, Value value) {
if (value.use_empty())
return failure();
std::optional<APInt> maybeConstValue = getMaybeConstantValue(solver, value);
Expand Down Expand Up @@ -95,6 +95,7 @@ static LogicalResult maybeReplaceWithConstant(DataFlowSolver &solver,
rewriter.replaceAllUsesWith(value, constOp->getResult(0));
return success();
}
} // namespace mlir::dataflow

namespace {
class DataFlowListener : public RewriterBase::Listener {
Expand Down
Loading