Skip to content

Commit ff5f8e5

Browse files
authored
[MLIR][Presburger] removeTrivialRedundancy: skip unnecessary check for duplicate constraints (#138969)
`removeTrivialRedundancy` first marks duplicate rows redundant, then when multiple rows differ only by a constant term, it removes all but one of them. Since the latter removes all but one duplicate row as well, it is unnecessary (redundant!) to mark duplicate rows redundant. So we remove this step.
1 parent 618a399 commit ff5f8e5

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

mlir/lib/Analysis/Presburger/IntegerRelation.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "mlir/Analysis/Presburger/Simplex.h"
2222
#include "mlir/Analysis/Presburger/Utils.h"
2323
#include "llvm/ADT/DenseMap.h"
24-
#include "llvm/ADT/DenseSet.h"
2524
#include "llvm/ADT/STLExtras.h"
2625
#include "llvm/ADT/Sequence.h"
2726
#include "llvm/ADT/SmallBitVector.h"
@@ -45,7 +44,6 @@ using namespace mlir;
4544
using namespace presburger;
4645

4746
using llvm::SmallDenseMap;
48-
using llvm::SmallDenseSet;
4947

5048
std::unique_ptr<IntegerRelation> IntegerRelation::clone() const {
5149
return std::make_unique<IntegerRelation>(*this);
@@ -1824,8 +1822,6 @@ void IntegerRelation::removeTrivialRedundancy() {
18241822
// for a given row.
18251823
SmallDenseMap<ArrayRef<DynamicAPInt>, std::pair<unsigned, DynamicAPInt>>
18261824
rowsWithoutConstTerm;
1827-
// To unique rows.
1828-
SmallDenseSet<ArrayRef<DynamicAPInt>, 8> rowSet;
18291825

18301826
// Check if constraint is of the form <non-negative-constant> >= 0.
18311827
auto isTriviallyValid = [&](unsigned r) -> bool {
@@ -1840,8 +1836,7 @@ void IntegerRelation::removeTrivialRedundancy() {
18401836
SmallVector<bool, 256> redunIneq(getNumInequalities(), false);
18411837
for (unsigned r = 0, e = getNumInequalities(); r < e; r++) {
18421838
DynamicAPInt *rowStart = &inequalities(r, 0);
1843-
auto row = ArrayRef<DynamicAPInt>(rowStart, getNumCols());
1844-
if (isTriviallyValid(r) || !rowSet.insert(row).second) {
1839+
if (isTriviallyValid(r)) {
18451840
redunIneq[r] = true;
18461841
continue;
18471842
}

0 commit comments

Comments
 (0)