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 @@ -42,10 +42,6 @@ /// Reset the dense lattice to a pessimistic value. This occurs when the /// analysis cannot reason about the data-flow. virtual ChangeResult reset() = 0; - - /// Returns true if the lattice state has reached a pessimistic fixpoint. That - /// is, no further modifications to the lattice can occur. - virtual bool isAtFixpoint() const = 0; }; //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h --- a/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h +++ b/mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h @@ -38,10 +38,6 @@ /// if the value of the lattice changed. virtual ChangeResult join(const AbstractSparseLattice &rhs) = 0; - /// Returns true if the lattice element is at fixpoint and further calls to - /// `join` will not update the value of the element. - virtual bool isAtFixpoint() const = 0; - /// Mark the lattice element as having reached a pessimistic fixpoint. This /// means that the lattice may potentially have conflicting value states, and /// only the most conservative value should be relied on. @@ -103,19 +99,14 @@ return markPessimisticFixpoint(); } - /// Returns true if the lattice has reached a fixpoint. A fixpoint is when - /// the information optimistically assumed to be true is the same as the - /// information known to be true. - bool isAtFixpoint() const override { return optimisticValue == knownValue; } - /// Join the information contained in the 'rhs' lattice into this /// lattice. Returns if the state of the current lattice changed. ChangeResult join(const AbstractSparseLattice &rhs) override { const Lattice &rhsLattice = static_cast &>(rhs); - // If we are at a fixpoint, or rhs is uninitialized, there is nothing to do. - if (isAtFixpoint() || rhsLattice.isUninitialized()) + // If rhs is uninitialized, there is nothing to do. + if (rhsLattice.isUninitialized()) return ChangeResult::NoChange; // Join the rhs value into this lattice. @@ -150,7 +141,7 @@ /// means that the lattice may potentially have conflicting value states, /// and only the conservatively known value state should be relied on. ChangeResult markPessimisticFixpoint() override { - if (isAtFixpoint()) + if (optimisticValue == knownValue) return ChangeResult::NoChange; // For this fixed point, we take whatever we knew to be true and set that 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 @@ -49,8 +49,6 @@ // Get the dense lattice to update. AbstractDenseLattice *after = getLattice(op); - if (after->isAtFixpoint()) - return; // If this op implements region control-flow, then control-flow dictates its // transfer function. @@ -91,8 +89,6 @@ // Get the dense lattice to update. AbstractDenseLattice *after = getLattice(block); - if (after->isAtFixpoint()) - return; // The dense lattices of entry blocks are set by region control-flow or the // callgraph. diff --git a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp --- a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp @@ -87,16 +87,10 @@ // Get the result lattices. SmallVector resultLattices; resultLattices.reserve(op->getNumResults()); - // Track whether all results have reached their fixpoint. - bool allAtFixpoint = true; for (Value result : op->getResults()) { AbstractSparseLattice *resultLattice = getLatticeElement(result); - allAtFixpoint &= resultLattice->isAtFixpoint(); resultLattices.push_back(resultLattice); } - // If all result lattices have reached a fixpoint, there is nothing to do. - if (allAtFixpoint) - return; // The results of a region branch operation are determined by control-flow. if (auto branch = dyn_cast(op)) { @@ -145,16 +139,10 @@ // Get the argument lattices. SmallVector argLattices; argLattices.reserve(block->getNumArguments()); - bool allAtFixpoint = true; for (BlockArgument argument : block->getArguments()) { AbstractSparseLattice *argLattice = getLatticeElement(argument); - allAtFixpoint &= argLattice->isAtFixpoint(); argLattices.push_back(argLattice); } - // If all argument lattices have reached their fixpoints, then there is - // nothing to do. - if (allAtFixpoint) - return; // The argument lattices of entry blocks are set by region control-flow or the // callgraph. diff --git a/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp b/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp --- a/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp +++ b/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp @@ -73,9 +73,6 @@ return ChangeResult::Change; } - /// The lattice is never at a fixpoint. - bool isAtFixpoint() const override { return false; } - /// Join the last modifications. ChangeResult join(const AbstractDenseLattice &lattice) override { const auto &rhs = static_cast(lattice);