[Mlir-commits] [mlir] de70ff1 - [MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Apr 1 05:10:42 PDT 2022


Author: Groverkss
Date: 2022-04-01T17:38:30+05:30
New Revision: de70ff10e4f6f216212016097771bad46dd5b3cc

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

LOG: [MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation

This patch modifies the name "integerRelations" and "relation" to refer to the
disjuncts in PresburgerRelation to "disjunct(s)".  This is done to be
consistent with the rest of the interface.

Reviewed By: arjunp

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

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h
    mlir/lib/Analysis/Presburger/PresburgerRelation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h b/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h
index 8093a710c5512..bc64fbef44dbc 100644
--- a/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h
+++ b/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h
@@ -27,11 +27,11 @@ class SetCoalescer;
 /// the same PresburgerSpace with support for union, intersection, subtraction,
 /// and complement operations, as well as sampling.
 ///
-/// The IntegerRelations (relations) are stored in a vector, and the set
+/// The IntegerRelations (disjuncts) are stored in a vector, and the set
 /// represents the union of these relations. An empty list corresponds to
 /// the empty set.
 ///
-/// Note that there are no invariants guaranteed on the list of relations
+/// Note that there are no invariants guaranteed on the list of disjuncts
 /// other than that they are all in the same PresburgerSpace. For example, the
 /// relations may overlap with each other.
 class PresburgerRelation : public PresburgerSpace {
@@ -44,17 +44,17 @@ class PresburgerRelation : public PresburgerSpace {
 
   explicit PresburgerRelation(const IntegerRelation &disjunct);
 
-  /// Return the number of Disjuncts in the union.
+  /// Return the number of disjuncts in the union.
   unsigned getNumDisjuncts() const;
 
-  /// Return a reference to the list of IntegerRelations.
+  /// Return a reference to the list of disjuncts.
   ArrayRef<IntegerRelation> getAllDisjuncts() const;
 
-  /// Return the IntegerRelation at the specified index.
+  /// Return the disjunct at the specified index.
   const IntegerRelation &getDisjunct(unsigned index) const;
 
   /// Mutate this set, turning it into the union of this set and the given
-  /// IntegerRelation.
+  /// disjunct.
   void unionInPlace(const IntegerRelation &disjunct);
 
   /// Mutate this set, turning it into the union of this set and the given set.
@@ -122,7 +122,7 @@ class PresburgerRelation : public PresburgerSpace {
   }
 
   /// The list of disjuncts that this set is the union of.
-  SmallVector<IntegerRelation, 2> integerRelations;
+  SmallVector<IntegerRelation, 2> disjuncts;
 
   friend class SetCoalescer;
 };

diff  --git a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
index 21d242b90765a..e917907f1770d 100644
--- a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp
@@ -22,23 +22,23 @@ PresburgerRelation::PresburgerRelation(const IntegerRelation &disjunct)
 }
 
 unsigned PresburgerRelation::getNumDisjuncts() const {
-  return integerRelations.size();
+  return disjuncts.size();
 }
 
 ArrayRef<IntegerRelation> PresburgerRelation::getAllDisjuncts() const {
-  return integerRelations;
+  return disjuncts;
 }
 
 const IntegerRelation &PresburgerRelation::getDisjunct(unsigned index) const {
-  assert(index < integerRelations.size() && "index out of bounds!");
-  return integerRelations[index];
+  assert(index < disjuncts.size() && "index out of bounds!");
+  return disjuncts[index];
 }
 
 /// Mutate this set, turning it into the union of this set and the given
 /// IntegerRelation.
 void PresburgerRelation::unionInPlace(const IntegerRelation &disjunct) {
   assert(isSpaceCompatible(disjunct) && "Spaces should match");
-  integerRelations.push_back(disjunct);
+  disjuncts.push_back(disjunct);
 }
 
 /// Mutate this set, turning it into the union of this set and the given set.
@@ -47,7 +47,7 @@ void PresburgerRelation::unionInPlace(const IntegerRelation &disjunct) {
 /// to this set.
 void PresburgerRelation::unionInPlace(const PresburgerRelation &set) {
   assert(isSpaceCompatible(set) && "Spaces should match");
-  for (const IntegerRelation &disjunct : set.integerRelations)
+  for (const IntegerRelation &disjunct : set.disjuncts)
     unionInPlace(disjunct);
 }
 
@@ -62,7 +62,7 @@ PresburgerRelation::unionSet(const PresburgerRelation &set) const {
 
 /// A point is contained in the union iff any of the parts contain the point.
 bool PresburgerRelation::containsPoint(ArrayRef<int64_t> point) const {
-  return llvm::any_of(integerRelations, [&](const IntegerRelation &disjunct) {
+  return llvm::any_of(disjuncts, [&](const IntegerRelation &disjunct) {
     return (disjunct.containsPoint(point));
   });
 }
@@ -90,8 +90,8 @@ PresburgerRelation::intersect(const PresburgerRelation &set) const {
   assert(isSpaceCompatible(set) && "Spaces should match");
 
   PresburgerRelation result(getSpace());
-  for (const IntegerRelation &csA : integerRelations) {
-    for (const IntegerRelation &csB : set.integerRelations) {
+  for (const IntegerRelation &csA : disjuncts) {
+    for (const IntegerRelation &csB : set.disjuncts) {
       IntegerRelation intersection = csA.intersect(csB);
       if (!intersection.isEmpty())
         result.unionInPlace(intersection);
@@ -311,7 +311,7 @@ PresburgerRelation::subtract(const PresburgerRelation &set) const {
   assert(isSpaceCompatible(set) && "Spaces should match");
   PresburgerRelation result(getSpace());
   // We compute (U_i t_i) \ (U_i set_i) as U_i (t_i \ V_i set_i).
-  for (const IntegerRelation &disjunct : integerRelations)
+  for (const IntegerRelation &disjunct : disjuncts)
     result.unionInPlace(getSetDifference(disjunct, set));
   return result;
 }
@@ -333,13 +333,12 @@ bool PresburgerRelation::isEqual(const PresburgerRelation &set) const {
 /// false otherwise.
 bool PresburgerRelation::isIntegerEmpty() const {
   // The set is empty iff all of the disjuncts are empty.
-  return llvm::all_of(integerRelations,
-                      std::mem_fn(&IntegerRelation::isIntegerEmpty));
+  return llvm::all_of(disjuncts, std::mem_fn(&IntegerRelation::isIntegerEmpty));
 }
 
 bool PresburgerRelation::findIntegerSample(SmallVectorImpl<int64_t> &sample) {
   // A sample exists iff any of the disjuncts contains a sample.
-  for (const IntegerRelation &disjunct : integerRelations) {
+  for (const IntegerRelation &disjunct : disjuncts) {
     if (Optional<SmallVector<int64_t, 8>> opt = disjunct.findIntegerSample()) {
       sample = std::move(*opt);
       return true;
@@ -353,7 +352,7 @@ Optional<uint64_t> PresburgerRelation::computeVolume() const {
   // The sum of the volumes of the disjuncts is a valid overapproximation of the
   // volume of their union, even if they overlap.
   uint64_t result = 0;
-  for (const IntegerRelation &disjunct : integerRelations) {
+  for (const IntegerRelation &disjunct : disjuncts) {
     Optional<uint64_t> volume = disjunct.computeVolume();
     if (!volume)
       return {};
@@ -452,7 +451,7 @@ class presburger::SetCoalescer {
 /// `IntegerRelation`s to the `disjuncts` vector.
 SetCoalescer::SetCoalescer(const PresburgerRelation &s) {
 
-  disjuncts = s.integerRelations;
+  disjuncts = s.disjuncts;
 
   simplices.reserve(s.getNumDisjuncts());
   // Note that disjuncts.size() changes during the loop.
@@ -699,7 +698,7 @@ PresburgerRelation PresburgerRelation::coalesce() const {
 
 void PresburgerRelation::print(raw_ostream &os) const {
   os << "Number of Disjuncts: " << getNumDisjuncts() << "\n";
-  for (const IntegerRelation &disjunct : integerRelations) {
+  for (const IntegerRelation &disjunct : disjuncts) {
     disjunct.print(os);
     os << '\n';
   }


        


More information about the Mlir-commits mailing list