@@ -172,8 +172,10 @@ GeneratingFunction mlir::presburger::detail::unimodularConeGeneratingFunction(
172172Point mlir::presburger::detail::getNonOrthogonalVector (
173173 ArrayRef<Point> vectors) {
174174 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!" );
177179
178180 SmallVector<Fraction> newPoint = {Fraction (1 , 1 )};
179181 Fraction maxDisallowedValue = -Fraction (1 , 0 ),
@@ -216,11 +218,12 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
216218 " division by empty denominator in rational function!" );
217219
218220 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!" );
224227
225228 std::vector<QuasiPolynomial> coefficients;
226229 coefficients.reserve (power + 1 );
@@ -241,4 +244,4 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
241244 coefficients[i] = coefficients[i] / den[0 ];
242245 }
243246 return coefficients[power].simplify ();
244- }
247+ }
0 commit comments