File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
include/mlir/Analysis/Presburger Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ class IntegerRelation : public PresburgerLocalSpace {
95
95
// / intersection with no simplification of any sort attempted.
96
96
void append (const IntegerRelation &other);
97
97
98
+ // / Return the intersection of the two sets.
99
+ // / If there are locals, they will be merged.
100
+ IntegerRelation intersect (IntegerRelation other) const ;
101
+
98
102
// / Return whether `this` and `other` are equal. This is integer-exact
99
103
// / and somewhat expensive, since it uses the integer emptiness check
100
104
// / (see IntegerRelation::findIntegerSample()).
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ void IntegerRelation::append(const IntegerRelation &other) {
52
52
}
53
53
}
54
54
55
+ IntegerRelation IntegerRelation::intersect (IntegerRelation other) const {
56
+ IntegerRelation result = *this ;
57
+ result.mergeLocalIds (other);
58
+ result.append (other);
59
+ return result;
60
+ }
61
+
55
62
bool IntegerRelation::isEqual (const IntegerRelation &other) const {
56
63
assert (PresburgerLocalSpace::isEqual (other) && " Spaces must be equal." );
57
64
return PresburgerRelation (*this ).isEqual (PresburgerRelation (other));
Original file line number Diff line number Diff line change @@ -97,11 +97,9 @@ PresburgerRelation::intersect(const PresburgerRelation &set) const {
97
97
getNumSymbolIds ());
98
98
for (const IntegerRelation &csA : integerRelations) {
99
99
for (const IntegerRelation &csB : set.integerRelations ) {
100
- IntegerRelation csACopy = csA, csBCopy = csB;
101
- csACopy.mergeLocalIds (csBCopy);
102
- csACopy.append (csBCopy);
103
- if (!csACopy.isEmpty ())
104
- result.unionInPlace (csACopy);
100
+ IntegerRelation intersection = csA.intersect (csB);
101
+ if (!intersection.isEmpty ())
102
+ result.unionInPlace (intersection);
105
103
}
106
104
}
107
105
return result;
You can’t perform that action at this time.
0 commit comments