diff --git a/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h b/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h --- a/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h +++ b/mlir/include/mlir/Analysis/Presburger/PresburgerRelation.h @@ -27,11 +27,11 @@ /// 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 @@ 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 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 @@ } /// The list of disjuncts that this set is the union of. - SmallVector integerRelations; + SmallVector disjuncts; friend class SetCoalescer; }; diff --git a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp --- a/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp +++ b/mlir/lib/Analysis/Presburger/PresburgerRelation.cpp @@ -22,23 +22,23 @@ } unsigned PresburgerRelation::getNumDisjuncts() const { - return integerRelations.size(); + return disjuncts.size(); } ArrayRef 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 @@ /// 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 @@ /// A point is contained in the union iff any of the parts contain the point. bool PresburgerRelation::containsPoint(ArrayRef 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 @@ 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 @@ 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 @@ /// 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 &sample) { // A sample exists iff any of the disjuncts contains a sample. - for (const IntegerRelation &disjunct : integerRelations) { + for (const IntegerRelation &disjunct : disjuncts) { if (Optional> opt = disjunct.findIntegerSample()) { sample = std::move(*opt); return true; @@ -353,7 +352,7 @@ // 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 volume = disjunct.computeVolume(); if (!volume) return {}; @@ -452,7 +451,7 @@ /// `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 @@ 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'; }