@@ -172,8 +172,10 @@ GeneratingFunction mlir::presburger::detail::unimodularConeGeneratingFunction(
172
172
Point mlir::presburger::detail::getNonOrthogonalVector (
173
173
ArrayRef<Point> vectors) {
174
174
unsigned dim = vectors[0 ].size ();
175
- for (const Point &vector : vectors)
176
- assert (vector.size () == dim && " all vectors need to be the same size!" );
175
+ assert (
176
+ llvm::all_of (vectors,
177
+ [&](const Point &vector) { return vector.size () == dim; }) &&
178
+ " all vectors need to be the same size!" );
177
179
178
180
SmallVector<Fraction> newPoint = {Fraction (1 , 1 )};
179
181
Fraction maxDisallowedValue = -Fraction (1 , 0 ),
@@ -216,11 +218,12 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
216
218
" division by empty denominator in rational function!" );
217
219
218
220
unsigned numParam = num[0 ].getNumInputs ();
219
- for (const QuasiPolynomial &qp : num)
220
- // We use the `isEqual` method of PresburgerSpace, which QuasiPolynomial
221
- // inherits from.
222
- assert (num[0 ].isEqual (qp) &&
223
- " the quasipolynomials should all belong to the same space!" );
221
+ // We use the `isEqual` method of PresburgerSpace, which QuasiPolynomial
222
+ // inherits from.
223
+ assert (
224
+ llvm::all_of (
225
+ num, [&](const QuasiPolynomial &qp) { return num[0 ].isEqual (qp); }) &&
226
+ " the quasipolynomials should all belong to the same space!" );
224
227
225
228
std::vector<QuasiPolynomial> coefficients;
226
229
coefficients.reserve (power + 1 );
@@ -241,4 +244,4 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
241
244
coefficients[i] = coefficients[i] / den[0 ];
242
245
}
243
246
return coefficients[power].simplify ();
244
- }
247
+ }
0 commit comments