[Mlir-commits] [mlir] 0c1f686 - [MLIR][Presburger] Move Presburger/ files to presburger namespace

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 25 02:36:57 PST 2022


Author: Groverkss
Date: 2022-02-25T16:01:29+05:30
New Revision: 0c1f6865e9b246d1b207c644706eb0c9661d2a03

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

LOG: [MLIR][Presburger] Move Presburger/ files to presburger namespace

This patch moves the Presburger library to a new `presburger` namespace.

This allows to shorten some names, helps to avoid polluting the mlir namespace,
and also provides some structure.

Reviewed By: arjunp

Differential Revision: https://reviews.llvm.org/D120505

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/Presburger/Fraction.h
    mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
    mlir/include/mlir/Analysis/Presburger/LinearTransform.h
    mlir/include/mlir/Analysis/Presburger/Matrix.h
    mlir/include/mlir/Analysis/Presburger/PWMAFunction.h
    mlir/include/mlir/Analysis/Presburger/PresburgerSet.h
    mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h
    mlir/include/mlir/Analysis/Presburger/Simplex.h
    mlir/include/mlir/Analysis/Presburger/Utils.h
    mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
    mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
    mlir/lib/Analysis/Presburger/LinearTransform.cpp
    mlir/lib/Analysis/Presburger/Matrix.cpp
    mlir/lib/Analysis/Presburger/PWMAFunction.cpp
    mlir/lib/Analysis/Presburger/PresburgerSet.cpp
    mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
    mlir/lib/Analysis/Presburger/Simplex.cpp
    mlir/lib/Analysis/Presburger/Utils.cpp
    mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
    mlir/lib/Dialect/Affine/Analysis/Utils.cpp
    mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
    mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp
    mlir/unittests/Analysis/Presburger/MatrixTest.cpp
    mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
    mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
    mlir/unittests/Analysis/Presburger/PresburgerSpaceTest.cpp
    mlir/unittests/Analysis/Presburger/SimplexTest.cpp
    mlir/unittests/Analysis/Presburger/Utils.h
    mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
    mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/Presburger/Fraction.h b/mlir/include/mlir/Analysis/Presburger/Fraction.h
index c1ff333f6e441..e26c47f6e341d 100644
--- a/mlir/include/mlir/Analysis/Presburger/Fraction.h
+++ b/mlir/include/mlir/Analysis/Presburger/Fraction.h
@@ -17,6 +17,7 @@
 #include "mlir/Support/MathExtras.h"
 
 namespace mlir {
+namespace presburger {
 
 /// A class to represent fractions. The sign of the fraction is represented
 /// in the sign of the numerator; the denominator is always positive.
@@ -81,6 +82,7 @@ inline Fraction operator*(Fraction x, Fraction y) {
   return Fraction(x.num * y.num, x.den * y.den);
 }
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_FRACTION_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
index f9b3f84d5e1cc..d2554d3f1b51a 100644
--- a/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
+++ b/mlir/include/mlir/Analysis/Presburger/IntegerPolyhedron.h
@@ -20,6 +20,7 @@
 #include "mlir/Support/LogicalResult.h"
 
 namespace mlir {
+namespace presburger {
 
 /// An IntegerRelation is a PresburgerLocalSpace subject to affine constraints.
 /// Affine constraints can be inequalities or equalities in the form:
@@ -254,15 +255,13 @@ class IntegerPolyhedron : public IntegerRelation {
   /// constraints. Returns an empty optional if the polyhedron is empty or if
   /// the lexmin is unbounded. Symbols are not supported and will result in
   /// assert-failure.
-  presburger_utils::MaybeOptimum<SmallVector<Fraction, 8>>
-  findRationalLexMin() const;
+  MaybeOptimum<SmallVector<Fraction, 8>> 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>>
-  findIntegerLexMin() const;
+  MaybeOptimum<SmallVector<int64_t, 8>> findIntegerLexMin() const;
 
   /// Swap the posA^th identifier with the posB^th identifier.
   virtual void swapId(unsigned posA, unsigned posB);
@@ -343,8 +342,8 @@ class IntegerPolyhedron : public IntegerRelation {
   /// to 0.
   void getLocalReprs(std::vector<SmallVector<int64_t, 8>> &dividends,
                      SmallVector<unsigned, 4> &denominators,
-                     std::vector<presburger_utils::MaybeLocalRepr> &repr) const;
-  void getLocalReprs(std::vector<presburger_utils::MaybeLocalRepr> &repr) const;
+                     std::vector<MaybeLocalRepr> &repr) const;
+  void getLocalReprs(std::vector<MaybeLocalRepr> &repr) const;
   void getLocalReprs(std::vector<SmallVector<int64_t, 8>> &dividends,
                      SmallVector<unsigned, 4> &denominators) const;
 
@@ -563,6 +562,7 @@ class IntegerPolyhedron : public IntegerRelation {
   constexpr static unsigned kExplosionFactor = 32;
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_INTEGERPOLYHEDRON_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/LinearTransform.h b/mlir/include/mlir/Analysis/Presburger/LinearTransform.h
index 107e57fa5e02b..0a7534cc37845 100644
--- a/mlir/include/mlir/Analysis/Presburger/LinearTransform.h
+++ b/mlir/include/mlir/Analysis/Presburger/LinearTransform.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/SmallVector.h"
 
 namespace mlir {
+namespace presburger {
 
 class LinearTransform {
 public:
@@ -54,5 +55,7 @@ class LinearTransform {
   Matrix matrix;
 };
 
+} // namespace presburger
 } // namespace mlir
+
 #endif // MLIR_ANALYSIS_PRESBURGER_LINEARTRANSFORM_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/Matrix.h b/mlir/include/mlir/Analysis/Presburger/Matrix.h
index 95d663c69078c..f94edfff37df3 100644
--- a/mlir/include/mlir/Analysis/Presburger/Matrix.h
+++ b/mlir/include/mlir/Analysis/Presburger/Matrix.h
@@ -21,6 +21,7 @@
 #include <cassert>
 
 namespace mlir {
+namespace presburger {
 
 /// This is a class to represent a resizable matrix.
 ///
@@ -160,6 +161,7 @@ class Matrix {
   SmallVector<int64_t, 64> data;
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_MATRIX_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h b/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h
index 26958e4308f13..006e6c3b8d2ed 100644
--- a/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h
+++ b/mlir/include/mlir/Analysis/Presburger/PWMAFunction.h
@@ -20,6 +20,7 @@
 #include "mlir/Analysis/Presburger/PresburgerSet.h"
 
 namespace mlir {
+namespace presburger {
 
 /// This class represents a multi-affine function whose domain is given by an
 /// IntegerPolyhedron. This can be thought of as an IntegerPolyhedron with a
@@ -186,6 +187,7 @@ class PWMAFunction : PresburgerSpace {
   unsigned numOutputs;
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_PWMAFUNCTION_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/PresburgerSet.h b/mlir/include/mlir/Analysis/Presburger/PresburgerSet.h
index 0bf7c8d7daad4..40636d6ba8536 100644
--- a/mlir/include/mlir/Analysis/Presburger/PresburgerSet.h
+++ b/mlir/include/mlir/Analysis/Presburger/PresburgerSet.h
@@ -16,6 +16,7 @@
 #include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
 
 namespace mlir {
+namespace presburger {
 
 /// This class can represent a union of IntegerPolyhedrons, with support for
 /// union, intersection, subtraction and complement operations, as well as
@@ -121,6 +122,7 @@ class PresburgerSet : public PresburgerSpace {
   SmallVector<IntegerPolyhedron, 2> integerPolyhedrons;
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_PRESBURGERSET_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h b/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h
index bff48f6a5662d..33804bb36633f 100644
--- a/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h
+++ b/mlir/include/mlir/Analysis/Presburger/PresburgerSpace.h
@@ -18,6 +18,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 namespace mlir {
+namespace presburger {
 
 class PresburgerLocalSpace;
 
@@ -194,6 +195,7 @@ class PresburgerLocalSpace : public PresburgerSpace {
       : PresburgerSpace(Set, /*numDomain=*/0, numDims, numSymbols, numLocals) {}
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_PRESBURGERSPACE_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/Simplex.h b/mlir/include/mlir/Analysis/Presburger/Simplex.h
index da1e55a7b12ad..775435eed3f26 100644
--- a/mlir/include/mlir/Analysis/Presburger/Simplex.h
+++ b/mlir/include/mlir/Analysis/Presburger/Simplex.h
@@ -27,6 +27,7 @@
 #include "llvm/Support/raw_ostream.h"
 
 namespace mlir {
+namespace presburger {
 
 class GBRSimplex;
 
@@ -438,13 +439,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>> findRationalLexMin();
+  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>> findIntegerLexMin();
+  MaybeOptimum<SmallVector<int64_t, 8>> findIntegerLexMin();
 
 protected:
   /// Returns the current sample point, which may contain non-integer (rational)
@@ -453,8 +454,7 @@ class LexSimplex : public SimplexBase {
   /// Returns an unbounded optimum when the big M parameter is used and a
   /// variable has a non-zero big M coefficient, meaning its value is infinite
   /// or unbounded.
-  presburger_utils::MaybeOptimum<SmallVector<Fraction, 8>>
-  getRationalSample() const;
+  MaybeOptimum<SmallVector<Fraction, 8>> getRationalSample() const;
 
   /// Given a row that has a non-integer sample value, add an inequality such
   /// that this fractional sample value is cut away from the polytope. The added
@@ -535,16 +535,15 @@ class Simplex : public SimplexBase {
   ///
   /// Returns a Fraction denoting the optimum, or a null value if no optimum
   /// exists, i.e., if the expression is unbounded in this direction.
-  presburger_utils::MaybeOptimum<Fraction>
-  computeRowOptimum(Direction direction, unsigned row);
+  MaybeOptimum<Fraction> computeRowOptimum(Direction direction, unsigned row);
 
   /// Compute the maximum or minimum value of the given expression, depending on
   /// direction. Should not be called when the Simplex is empty.
   ///
   /// Returns a Fraction denoting the optimum, or a null value if no optimum
   /// exists, i.e., if the expression is unbounded in this direction.
-  presburger_utils::MaybeOptimum<Fraction>
-  computeOptimum(Direction direction, ArrayRef<int64_t> coeffs);
+  MaybeOptimum<Fraction> computeOptimum(Direction direction,
+                                        ArrayRef<int64_t> coeffs);
 
   /// Returns whether the perpendicular of the specified constraint is a
   /// is a direction along which the polytope is bounded.
@@ -565,8 +564,7 @@ class Simplex : public SimplexBase {
   /// Returns a (min, max) pair denoting the minimum and maximum integer values
   /// of the given expression. If no integer value exists, both results will be
   /// of kind Empty.
-  std::pair<presburger_utils::MaybeOptimum<int64_t>,
-            presburger_utils::MaybeOptimum<int64_t>>
+  std::pair<MaybeOptimum<int64_t>, MaybeOptimum<int64_t>>
   computeIntegerBounds(ArrayRef<int64_t> coeffs);
 
   /// Returns true if the polytope is unbounded, i.e., extends to infinity in
@@ -650,8 +648,7 @@ class Simplex : public SimplexBase {
   ///
   /// Returns a Fraction denoting the optimum, or a null value if no optimum
   /// exists, i.e., if the expression is unbounded in this direction.
-  presburger_utils::MaybeOptimum<Fraction> computeOptimum(Direction direction,
-                                                          Unknown &u);
+  MaybeOptimum<Fraction> computeOptimum(Direction direction, Unknown &u);
 
   /// Mark the specified unknown redundant. This operation is added to the undo
   /// log and will be undone by rollbacks. The specified unknown must be in row
@@ -663,6 +660,7 @@ class Simplex : public SimplexBase {
   void reduceBasis(Matrix &basis, unsigned level);
 };
 
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_SIMPLEX_H

diff  --git a/mlir/include/mlir/Analysis/Presburger/Utils.h b/mlir/include/mlir/Analysis/Presburger/Utils.h
index 8d366f34d1509..2687abe471dd0 100644
--- a/mlir/include/mlir/Analysis/Presburger/Utils.h
+++ b/mlir/include/mlir/Analysis/Presburger/Utils.h
@@ -17,11 +17,10 @@
 #include "llvm/ADT/STLExtras.h"
 
 namespace mlir {
+namespace presburger {
 
 class IntegerPolyhedron;
 
-namespace presburger_utils {
-
 /// This class represents the result of operations optimizing something subject
 /// to some constraints. If the constraints were not satisfiable the, kind will
 /// be Empty. If the optimum is unbounded, the kind is Unbounded, and if the
@@ -131,7 +130,7 @@ void removeDuplicateDivs(
     SmallVectorImpl<unsigned> &denoms, unsigned localOffset,
     llvm::function_ref<bool(unsigned i, unsigned j)> merge);
 
-} // namespace presburger_utils
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_ANALYSIS_PRESBURGER_UTILS_H

diff  --git a/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
index 3f3f854e434d5..374f0ce73570f 100644
--- a/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
@@ -57,7 +57,7 @@ struct MutableAffineMap;
 /// that some floordiv combinations are converted to mod's by AffineExpr
 /// construction.
 ///
-class FlatAffineConstraints : public IntegerPolyhedron {
+class FlatAffineConstraints : public presburger::IntegerPolyhedron {
 public:
   /// Constructs a constraint system reserving memory for the specified number
   /// of constraints and identifiers.

diff  --git a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
index e87c8bc672727..10df34a37d6ac 100644
--- a/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerPolyhedron.cpp
@@ -22,7 +22,8 @@
 #define DEBUG_TYPE "presburger"
 
 using namespace mlir;
-using namespace presburger_utils;
+using namespace presburger;
+
 using llvm::SmallDenseMap;
 using llvm::SmallDenseSet;
 

diff  --git a/mlir/lib/Analysis/Presburger/LinearTransform.cpp b/mlir/lib/Analysis/Presburger/LinearTransform.cpp
index ab34f53625658..b75b9d4360c35 100644
--- a/mlir/lib/Analysis/Presburger/LinearTransform.cpp
+++ b/mlir/lib/Analysis/Presburger/LinearTransform.cpp
@@ -9,7 +9,8 @@
 #include "mlir/Analysis/Presburger/LinearTransform.h"
 #include "mlir/Analysis/Presburger/IntegerPolyhedron.h"
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
 LinearTransform::LinearTransform(Matrix &&oMatrix) : matrix(oMatrix) {}
 LinearTransform::LinearTransform(const Matrix &oMatrix) : matrix(oMatrix) {}
@@ -137,5 +138,3 @@ LinearTransform::applyTo(const IntegerPolyhedron &poly) const {
 
   return result;
 }
-
-} // namespace mlir

diff  --git a/mlir/lib/Analysis/Presburger/Matrix.cpp b/mlir/lib/Analysis/Presburger/Matrix.cpp
index cdad8ab24ea8b..00f96e596b4cf 100644
--- a/mlir/lib/Analysis/Presburger/Matrix.cpp
+++ b/mlir/lib/Analysis/Presburger/Matrix.cpp
@@ -9,7 +9,8 @@
 #include "mlir/Analysis/Presburger/Matrix.h"
 #include "llvm/Support/MathExtras.h"
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
 Matrix::Matrix(unsigned rows, unsigned columns, unsigned reservedRows,
                unsigned reservedColumns)
@@ -247,5 +248,3 @@ bool Matrix::hasConsistentState() const {
         return false;
   return true;
 }
-
-} // namespace mlir

diff  --git a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
index 385f135767c82..a9b1ccce1ccd1 100644
--- a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
+++ b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
@@ -10,6 +10,7 @@
 #include "mlir/Analysis/Presburger/Simplex.h"
 
 using namespace mlir;
+using namespace presburger;
 
 // Return the result of subtracting the two given vectors pointwise.
 // The vectors must be of the same size.

diff  --git a/mlir/lib/Analysis/Presburger/PresburgerSet.cpp b/mlir/lib/Analysis/Presburger/PresburgerSet.cpp
index 82946297c7e09..5b3f434ec9b67 100644
--- a/mlir/lib/Analysis/Presburger/PresburgerSet.cpp
+++ b/mlir/lib/Analysis/Presburger/PresburgerSet.cpp
@@ -14,7 +14,7 @@
 #include "llvm/ADT/SmallBitVector.h"
 
 using namespace mlir;
-using namespace presburger_utils;
+using namespace presburger;
 
 PresburgerSet::PresburgerSet(const IntegerPolyhedron &poly)
     : PresburgerSpace(poly) {

diff  --git a/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp b/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
index b65fc2214dbe7..6fdc7407c1cc7 100644
--- a/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
+++ b/mlir/lib/Analysis/Presburger/PresburgerSpace.cpp
@@ -11,6 +11,7 @@
 #include <cassert>
 
 using namespace mlir;
+using namespace presburger;
 
 PresburgerSpace PresburgerSpace::getRelationSpace(unsigned numDomain,
                                                   unsigned numRange,

diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 02eb323c1820a..f5e63456bfebc 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -11,9 +11,9 @@
 #include "mlir/Support/MathExtras.h"
 #include "llvm/ADT/Optional.h"
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
-using namespace presburger_utils;
 using Direction = Simplex::Direction;
 
 const int nullIndex = std::numeric_limits<int>::max();
@@ -1146,7 +1146,7 @@ Optional<SmallVector<int64_t, 8>> Simplex::getSamplePointIfIntegral() const {
 /// also supports rolling back this addition, by maintaining a snapshot stack
 /// that contains a snapshot of the Simplex's state for each equality, just
 /// before that equality was added.
-class GBRSimplex {
+class presburger::GBRSimplex {
   using Orientation = Simplex::Orientation;
 
 public:
@@ -1719,5 +1719,3 @@ bool Simplex::isRedundantEquality(ArrayRef<int64_t> coeffs) {
   return minimum.isBounded() && maximum.isBounded() &&
          *maximum == Fraction(0, 1) && *minimum == Fraction(0, 1);
 }
-
-} // namespace mlir

diff  --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index c6f377acfa608..72f66ca026dd7 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -16,7 +16,7 @@
 #include "mlir/Support/MathExtras.h"
 
 using namespace mlir;
-using namespace presburger_utils;
+using namespace presburger;
 
 /// Normalize a division's `dividend` and the `divisor` by their GCD. For
 /// example: if the dividend and divisor are [2,0,4] and 4 respectively,
@@ -213,7 +213,7 @@ static bool checkExplicitRepresentation(const IntegerPolyhedron &cst,
 /// the representation could be computed, `dividend` and `denominator` are set.
 /// If the representation could not be computed, the kind attribute in
 /// `MaybeLocalRepr` is set to None.
-MaybeLocalRepr presburger_utils::computeSingleVarRepr(
+MaybeLocalRepr presburger::computeSingleVarRepr(
     const IntegerPolyhedron &cst, ArrayRef<bool> foundRepr, unsigned pos,
     SmallVector<int64_t, 8> &dividend, unsigned &divisor) {
   assert(pos < cst.getNumIds() && "invalid position");
@@ -253,7 +253,7 @@ MaybeLocalRepr presburger_utils::computeSingleVarRepr(
   return repr;
 }
 
-void presburger_utils::removeDuplicateDivs(
+void presburger::removeDuplicateDivs(
     std::vector<SmallVector<int64_t, 8>> &divs,
     SmallVectorImpl<unsigned> &denoms, unsigned localOffset,
     llvm::function_ref<bool(unsigned i, unsigned j)> merge) {

diff  --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index c8d8d328246f5..5ac69e97232bd 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -31,7 +31,7 @@
 #define DEBUG_TYPE "affine-structures"
 
 using namespace mlir;
-using namespace presburger_utils;
+using namespace presburger;
 
 namespace {
 

diff  --git a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
index d6ceb0ef6477b..0eb5289f45c64 100644
--- a/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/Utils.cpp
@@ -27,6 +27,7 @@
 #define DEBUG_TYPE "analysis-utils"
 
 using namespace mlir;
+using namespace presburger;
 
 using llvm::SmallDenseMap;
 

diff  --git a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
index 395889cf4afca..cdd1fdfa37a57 100644
--- a/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/IntegerPolyhedronTest.cpp
@@ -16,8 +16,9 @@
 
 #include <numeric>
 
-namespace mlir {
-using namespace presburger_utils;
+using namespace mlir;
+using namespace presburger;
+
 using testing::ElementsAre;
 
 enum class TestFunction { Sample, Empty };
@@ -1185,5 +1186,3 @@ TEST(IntegerPolyhedronTest, computeVolume) {
       parsePoly("(x, y) : (2*x - y >= 0, y - 3*x >= 0)"),
       /*trueVolume=*/{}, /*resultBound=*/{});
 }
-
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp b/mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp
index 01b6b7fc960ce..5aad9f96ae21e 100644
--- a/mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/LinearTransformTest.cpp
@@ -10,7 +10,8 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
 void testColumnEchelonForm(const Matrix &m, unsigned expectedRank) {
   unsigned lastAllowedNonZeroCol = 0;
@@ -85,4 +86,3 @@ TEST(LinearTransformTest, transformToColumnEchelonTest) {
   m6(1, 1) = -7;
   testColumnEchelonForm(m5, 2u);
 }
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/MatrixTest.cpp b/mlir/unittests/Analysis/Presburger/MatrixTest.cpp
index e856302483571..e0c798c43dfb4 100644
--- a/mlir/unittests/Analysis/Presburger/MatrixTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/MatrixTest.cpp
@@ -10,7 +10,8 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
 TEST(MatrixTest, ReadWrite) {
   Matrix mat(5, 5);
@@ -190,5 +191,3 @@ TEST(MatrixTest, resize) {
     for (unsigned col = 0; col < 7; ++col)
       EXPECT_EQ(mat(row, col), row >= 3 || col >= 3 ? 0 : int(10 * row + col));
 }
-
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp b/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
index 0d269367493e7..0f47690f909b8 100644
--- a/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/PWMAFunctionTest.cpp
@@ -19,7 +19,9 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
+
 using testing::ElementsAre;
 
 static Matrix makeMatrix(unsigned numRow, unsigned numColumns,
@@ -168,5 +170,3 @@ TEST(PWMAFunction, valueAt) {
   EXPECT_THAT(*nonNegPWAF.valueAt({2, -3}), ElementsAre(-1, -1));
   EXPECT_FALSE(nonNegPWAF.valueAt({-2, -3}).hasValue());
 }
-
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
index 14b33f7f0afbb..b176f8912ae34 100644
--- a/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/PresburgerSetTest.cpp
@@ -21,7 +21,9 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
+
 /// Parse a list of StringRefs to IntegerPolyhedron and combine them into a
 /// PresburgerSet be using the union operation. It is expected that the strings
 /// are all valid IntegerSet representation and that all of them have the same
@@ -661,5 +663,3 @@ TEST(SetTest, computeVolume) {
                                         /*trueVolume=*/{},
                                         /*resultBound=*/{});
 }
-
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/PresburgerSpaceTest.cpp b/mlir/unittests/Analysis/Presburger/PresburgerSpaceTest.cpp
index 0716397b7c730..01be97a5d9768 100644
--- a/mlir/unittests/Analysis/Presburger/PresburgerSpaceTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/PresburgerSpaceTest.cpp
@@ -11,6 +11,8 @@
 #include <gtest/gtest.h>
 
 using namespace mlir;
+using namespace presburger;
+
 using IdKind = PresburgerSpace::IdKind;
 
 TEST(PresburgerSpaceTest, insertId) {

diff  --git a/mlir/unittests/Analysis/Presburger/SimplexTest.cpp b/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
index d5020befb8a6e..0edc5f0da019f 100644
--- a/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/SimplexTest.cpp
@@ -14,8 +14,8 @@
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
-namespace mlir {
-using namespace presburger_utils;
+using namespace mlir;
+using namespace presburger;
 
 /// Take a snapshot, add constraints making the set empty, and rollback.
 /// The set should not be empty after rolling back. We add additional
@@ -538,5 +538,3 @@ TEST(SimplexTest, IsRationalSubsetOf) {
   EXPECT_TRUE(sim2.isRationalSubsetOf(s2));
   EXPECT_FALSE(sim2.isRationalSubsetOf(empty));
 }
-
-} // namespace mlir

diff  --git a/mlir/unittests/Analysis/Presburger/Utils.h b/mlir/unittests/Analysis/Presburger/Utils.h
index 29a855ec1795f..eaa05926e54fb 100644
--- a/mlir/unittests/Analysis/Presburger/Utils.h
+++ b/mlir/unittests/Analysis/Presburger/Utils.h
@@ -21,6 +21,8 @@
 #include <gtest/gtest.h>
 
 namespace mlir {
+namespace presburger {
+
 /// Parses a IntegerPolyhedron from a StringRef. It is expected that the
 /// string represents a valid IntegerSet, otherwise it will violate a gtest
 /// assertion.
@@ -55,6 +57,8 @@ expectComputedVolumeIsValidOverapprox(Optional<uint64_t> computedVolume,
   EXPECT_TRUE(infinityOrUInt64LE(trueVolume, computedVolume));
   EXPECT_TRUE(infinityOrUInt64LE(computedVolume, resultBound));
 }
+
+} // namespace presburger
 } // namespace mlir
 
 #endif // MLIR_UNITTESTS_ANALYSIS_PRESBURGER_UTILS_H

diff  --git a/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
index dcb63aef74c27..2b50b544afb3f 100644
--- a/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
+++ b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParser.h
@@ -18,6 +18,7 @@
 #include "mlir/Support/LogicalResult.h"
 
 namespace mlir {
+
 /// This parses a single IntegerSet to an MLIR context and transforms it to
 /// FlatAffineConstraints if it was valid. If not, a failure is returned. If the
 /// passed `str` has additional tokens that were not part of the IntegerSet, a

diff  --git a/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
index 035eefabe645b..f588c2f1eca60 100644
--- a/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
+++ b/mlir/unittests/Dialect/Affine/Analysis/AffineStructuresParserTest.cpp
@@ -18,7 +18,8 @@
 
 #include <gtest/gtest.h>
 
-namespace mlir {
+using namespace mlir;
+using namespace presburger;
 
 /// Construct a FlatAffineConstraints from a set of inequality, equality, and
 /// division onstraints.
@@ -133,5 +134,3 @@ TEST(ParseFACTest, ParseAndCompareTest) {
                              {{{0, 1, 0}, 2}, {{1, 0, 1, 0}, 3}}),
       &context));
 }
-
-} // namespace mlir


        


More information about the Mlir-commits mailing list