[Mlir-commits] [mlir] cfd6ba8 - [MLIR][Presburger] rename get*LexMin -> find*LexMin

Arjun P llvmlistbot at llvm.org
Tue Feb 22 03:05:39 PST 2022


Author: Arjun P
Date: 2022-02-22T11:00:22Z
New Revision: cfd6ba89fd9f0572a9aaf76ff3da3f46e265ad75

URL: https://github.com/llvm/llvm-project/commit/cfd6ba89fd9f0572a9aaf76ff3da3f46e265ad75
DIFF: https://github.com/llvm/llvm-project/commit/cfd6ba89fd9f0572a9aaf76ff3da3f46e265ad75.diff

LOG: [MLIR][Presburger] rename get*LexMin -> find*LexMin

This reflects the fact that we are performing some non-trivial computations
here. Also, this is more uniform in line with findIntegerSample.

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
    mlir/include/mlir/Analysis/Presburger/Simplex.h
    mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
    mlir/lib/Analysis/Presburger/Simplex.cpp
    mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
index 834e3b0edce18..f9b3f84d5e1cc 100644
--- a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
+++ b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
@@ -255,14 +255,14 @@ class IntegerPolyhedron : public IntegerRelation {
   /// the lexmin is unbounded. Symbols are not supported and will result in
   /// assert-failure.
   presburger_utils::MaybeOptimum<SmallVector<Fraction, 8>>
-  getRationalLexMin() const;
+  findRationalLexMin() const;
 
   /// Same as above, but returns lexicographically minimal integer point.
   /// Note: this should be used only when the lexmin is really required.
   /// For a generic integer sampling operation, findIntegerSample is more
   /// robust and should be preferred.
   presburger_utils::MaybeOptimum<SmallVector<int64_t, 8>>
-  getIntegerLexMin() const;
+  findIntegerLexMin() const;
 
   /// Swap the posA^th identifier with the posB^th identifier.
   virtual void swapId(unsigned posA, unsigned posB);

diff  --git a/mlir/include/mlir/Analysis/Presburger/Simplex.h b/mlir/include/mlir/Analysis/Presburger/Simplex.h
index d5e14f717e925..83f4d398b67c9 100644
--- a/mlir/include/mlir/Analysis/Presburger/Simplex.h
+++ b/mlir/include/mlir/Analysis/Presburger/Simplex.h
@@ -438,13 +438,13 @@ class LexSimplex : public SimplexBase {
   unsigned getSnapshot() { return SimplexBase::getSnapshotBasis(); }
 
   /// Return the lexicographically minimum rational solution to the constraints.
-  presburger_utils::MaybeOptimum<SmallVector<Fraction, 8>> getRationalLexMin();
+  presburger_utils::MaybeOptimum<SmallVector<Fraction, 8>> findRationalLexMin();
 
   /// Return the lexicographically minimum integer solution to the constraints.
   ///
   /// Note: this should be used only when the lexmin is really needed. To obtain
   /// any integer sample, use Simplex::findIntegerSample as that is more robust.
-  presburger_utils::MaybeOptimum<SmallVector<int64_t, 8>> getIntegerLexMin();
+  presburger_utils::MaybeOptimum<SmallVector<int64_t, 8>> findIntegerLexMin();
 
 protected:
   /// Returns the current sample point, which may contain non-integer (rational)

diff  --git a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
index 5e26149303e6e..2380a214c0f2b 100644
--- a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
@@ -73,10 +73,10 @@ bool IntegerPolyhedron::isSubsetOf(const IntegerPolyhedron &other) const {
 }
 
 MaybeOptimum<SmallVector<Fraction, 8>>
-IntegerPolyhedron::getRationalLexMin() const {
+IntegerPolyhedron::findRationalLexMin() const {
   assert(getNumSymbolIds() == 0 && "Symbols are not supported!");
   MaybeOptimum<SmallVector<Fraction, 8>> maybeLexMin =
-      LexSimplex(*this).getRationalLexMin();
+      LexSimplex(*this).findRationalLexMin();
 
   if (!maybeLexMin.isBounded())
     return maybeLexMin;
@@ -93,10 +93,10 @@ IntegerPolyhedron::getRationalLexMin() const {
 }
 
 MaybeOptimum<SmallVector<int64_t, 8>>
-IntegerPolyhedron::getIntegerLexMin() const {
+IntegerPolyhedron::findIntegerLexMin() const {
   assert(getNumSymbolIds() == 0 && "Symbols are not supported!");
   MaybeOptimum<SmallVector<int64_t, 8>> maybeLexMin =
-      LexSimplex(*this).getIntegerLexMin();
+      LexSimplex(*this).findIntegerLexMin();
 
   if (!maybeLexMin.isBounded())
     return maybeLexMin.getKind();

diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 79ccae57573e5..02eb323c1820a 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -164,7 +164,7 @@ Direction flippedDirection(Direction direction) {
 }
 } // namespace
 
-MaybeOptimum<SmallVector<Fraction, 8>> LexSimplex::getRationalLexMin() {
+MaybeOptimum<SmallVector<Fraction, 8>> LexSimplex::findRationalLexMin() {
   restoreRationalConsistency();
   return getRationalSample();
 }
@@ -194,7 +194,7 @@ Optional<unsigned> LexSimplex::maybeGetNonIntegeralVarRow() const {
   return {};
 }
 
-MaybeOptimum<SmallVector<int64_t, 8>> LexSimplex::getIntegerLexMin() {
+MaybeOptimum<SmallVector<int64_t, 8>> LexSimplex::findIntegerLexMin() {
   while (!empty) {
     restoreRationalConsistency();
     if (empty)

diff  --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
index fffbf7527f994..e403ddd013ad1 100644
--- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
@@ -61,7 +61,7 @@ static void checkSample(bool hasSample, const IntegerPolyhedron &poly,
   switch (fn) {
   case TestFunction::Sample:
     maybeSample = poly.findIntegerSample();
-    maybeLexMin = poly.getIntegerLexMin();
+    maybeLexMin = poly.findIntegerLexMin();
 
     if (!hasSample) {
       EXPECT_FALSE(maybeSample.hasValue());
@@ -1081,7 +1081,7 @@ TEST(IntegerPolyhedronTest, negativeDividends) {
 
 void expectRationalLexMin(const IntegerPolyhedron &poly,
                           ArrayRef<Fraction> min) {
-  auto lexMin = poly.getRationalLexMin();
+  auto lexMin = poly.findRationalLexMin();
   ASSERT_TRUE(lexMin.isBounded());
   EXPECT_EQ(ArrayRef<Fraction>(*lexMin), min);
 }
@@ -1089,7 +1089,7 @@ void expectRationalLexMin(const IntegerPolyhedron &poly,
 void expectNoRationalLexMin(OptimumKind kind, const IntegerPolyhedron &poly) {
   ASSERT_NE(kind, OptimumKind::Bounded)
       << "Use expectRationalLexMin for bounded min";
-  EXPECT_EQ(poly.getRationalLexMin().getKind(), kind);
+  EXPECT_EQ(poly.findRationalLexMin().getKind(), kind);
 }
 
 TEST(IntegerPolyhedronTest, getRationalLexMin) {
@@ -1164,7 +1164,7 @@ TEST(IntegerPolyhedronTest, getRationalLexMin) {
 }
 
 void expectIntegerLexMin(const IntegerPolyhedron &poly, ArrayRef<int64_t> min) {
-  auto lexMin = poly.getIntegerLexMin();
+  auto lexMin = poly.findIntegerLexMin();
   ASSERT_TRUE(lexMin.isBounded());
   EXPECT_EQ(ArrayRef<int64_t>(*lexMin), min);
 }
@@ -1172,7 +1172,7 @@ void expectIntegerLexMin(const IntegerPolyhedron &poly, ArrayRef<int64_t> min) {
 void expectNoIntegerLexMin(OptimumKind kind, const IntegerPolyhedron &poly) {
   ASSERT_NE(kind, OptimumKind::Bounded)
       << "Use expectRationalLexMin for bounded min";
-  EXPECT_EQ(poly.getRationalLexMin().getKind(), kind);
+  EXPECT_EQ(poly.findRationalLexMin().getKind(), kind);
 }
 
 TEST(IntegerPolyhedronTest, getIntegerLexMin) {


        


More information about the Mlir-commits mailing list