[Mlir-commits] [mlir] [MLIR][Presburger] Add simplify function (PR #69107)

Kunwar Grover llvmlistbot at llvm.org
Sun Oct 15 13:39:19 PDT 2023


================
@@ -2216,6 +2288,74 @@ IntegerPolyhedron IntegerRelation::getDomainSet() const {
   return IntegerPolyhedron(std::move(copyRel));
 }
 
+bool IntegerRelation::removeDuplicateConstraints() {
+  bool changed = false;
+  SmallDenseMap<ArrayRef<MPInt>, unsigned> hashTable;
+  unsigned ineqs = getNumInequalities(), cols = getNumCols();
+
+  if (ineqs <= 1)
+    return changed;
+
+  // Check only the non-constant part of the constraint is the same.
+  auto row = getInequality(0).drop_back();
+  hashTable.insert({row, 0});
+  for (unsigned k = 1; k < ineqs; ++k) {
+    auto nRow = getInequality(k).drop_back();
----------------
Groverkss wrote:

nit: we generally use `nRow` for "number of rows". Use `row` or `ineq`.

https://github.com/llvm/llvm-project/pull/69107


More information about the Mlir-commits mailing list