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/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.