Skip to content

[MLIR][Presburger] removeTrivialRedundancy: skip unnecessary redundancy check #138969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
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
7 changes: 1 addition & 6 deletions mlir/lib/Analysis/Presburger/IntegerRelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "mlir/Analysis/Presburger/Simplex.h"
#include "mlir/Analysis/Presburger/Utils.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallBitVector.h"
Expand All @@ -45,7 +44,6 @@ using namespace mlir;
using namespace presburger;

using llvm::SmallDenseMap;
using llvm::SmallDenseSet;

std::unique_ptr<IntegerRelation> IntegerRelation::clone() const {
return std::make_unique<IntegerRelation>(*this);
Expand Down Expand Up @@ -1824,8 +1822,6 @@ void IntegerRelation::removeTrivialRedundancy() {
// for a given row.
SmallDenseMap<ArrayRef<DynamicAPInt>, std::pair<unsigned, DynamicAPInt>>
rowsWithoutConstTerm;
// To unique rows.
SmallDenseSet<ArrayRef<DynamicAPInt>, 8> rowSet;

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