@@ -361,7 +361,7 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(
361361 continue ;
362362 // If this subset corresponds to a vertex that has not been considered,
363363 // store it.
364- vertices.push_back (*vertex);
364+ vertices.emplace_back (*vertex);
365365
366366 // If a vertex is formed by the intersection of more than d facets, we
367367 // assume that any d-subset of these facets can be solved to obtain its
@@ -472,10 +472,10 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(
472472Point mlir::presburger::detail::getNonOrthogonalVector (
473473 ArrayRef<Point> vectors) {
474474 unsigned dim = vectors[0 ].size ();
475- assert (
476- llvm::all_of ( vectors,
477- [& ](const Point &vector) { return vector.size () == dim; }) &&
478- " all vectors need to be the same size!" );
475+ assert (llvm::all_of (
476+ vectors,
477+ [&dim ](const Point &vector) { return vector.size () == dim; }) &&
478+ " all vectors need to be the same size!" );
479479
480480 SmallVector<Fraction> newPoint = {Fraction (1 , 1 )};
481481 Fraction maxDisallowedValue = -Fraction (1 , 0 ),
@@ -493,7 +493,7 @@ Point mlir::presburger::detail::getNonOrthogonalVector(
493493 // Find the biggest such value
494494 maxDisallowedValue = std::max (maxDisallowedValue, disallowedValue);
495495 }
496- newPoint.push_back (maxDisallowedValue + 1 );
496+ newPoint.emplace_back (maxDisallowedValue + 1 );
497497 }
498498 return newPoint;
499499}
@@ -519,19 +519,20 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
519519 unsigned numParam = num[0 ].getNumInputs ();
520520 // We use the `isEqual` method of PresburgerSpace, which QuasiPolynomial
521521 // inherits from.
522- assert (
523- llvm::all_of (
524- num, [&](const QuasiPolynomial &qp) { return num[0 ].isEqual (qp); }) &&
525- " the quasipolynomials should all belong to the same space!" );
522+ assert (llvm::all_of (num,
523+ [&num](const QuasiPolynomial &qp) {
524+ return num[0 ].isEqual (qp);
525+ }) &&
526+ " the quasipolynomials should all belong to the same space!" );
526527
527528 std::vector<QuasiPolynomial> coefficients;
528529 coefficients.reserve (power + 1 );
529530
530- coefficients.push_back (num[0 ] / den[0 ]);
531+ coefficients.emplace_back (num[0 ] / den[0 ]);
531532 for (unsigned i = 1 ; i <= power; ++i) {
532533 // If the power is not there in the numerator, the coefficient is zero.
533- coefficients.push_back (i < num.size () ? num[i]
534- : QuasiPolynomial (numParam, 0 ));
534+ coefficients.emplace_back (i < num.size () ? num[i]
535+ : QuasiPolynomial (numParam, 0 ));
535536
536537 // After den.size(), the coefficients are zero, so we stop
537538 // subtracting at that point (if it is less than i).
@@ -573,15 +574,15 @@ substituteMuInTerm(unsigned numParams, const ParamPoint &v,
573574 SmallVector<Fraction> coefficients;
574575 coefficients.reserve (numDims);
575576 for (const Point &d : ds)
576- coefficients.push_back (-dotProduct (mu, d));
577+ coefficients.emplace_back (-dotProduct (mu, d));
577578
578579 // Then, the affine function is a single floor expression, given by the
579580 // corresponding column of v.
580581 ParamPoint vTranspose = v.transpose ();
581582 std::vector<std::vector<SmallVector<Fraction>>> affine;
582583 affine.reserve (numDims);
583584 for (unsigned j = 0 ; j < numDims; ++j)
584- affine.push_back ({SmallVector<Fraction>( vTranspose.getRow (j)) });
585+ affine.push_back ({SmallVector<Fraction>{ vTranspose.getRow (j)} });
585586
586587 QuasiPolynomial num (numParams, coefficients, affine);
587588 num = num.simplify ();
@@ -593,7 +594,7 @@ substituteMuInTerm(unsigned numParams, const ParamPoint &v,
593594 for (const Point &d : ds) {
594595 // This term in the denominator is
595596 // (1 - t^dens.back())
596- dens.push_back (dotProduct (d, mu));
597+ dens.emplace_back (dotProduct (d, mu));
597598 }
598599
599600 return {num, dens};
@@ -641,7 +642,7 @@ std::vector<QuasiPolynomial> getBinomialCoefficients(const QuasiPolynomial &n,
641642 coefficients.emplace_back (numParams, 1 );
642643 for (unsigned j = 1 ; j <= r; ++j)
643644 // We use the recursive formula for binomial coefficients here and below.
644- coefficients.push_back (
645+ coefficients.emplace_back (
645646 (coefficients[j - 1 ] * (n - QuasiPolynomial (numParams, j - 1 )) /
646647 Fraction (j, 1 ))
647648 .simplify ());
@@ -656,7 +657,7 @@ std::vector<Fraction> getBinomialCoefficients(const Fraction &n,
656657 coefficients.reserve ((int64_t )floor (r));
657658 coefficients.emplace_back (1 );
658659 for (unsigned j = 1 ; j <= r; ++j)
659- coefficients.push_back (coefficients[j - 1 ] * (n - (j - 1 )) / (j));
660+ coefficients.emplace_back (coefficients[j - 1 ] * (n - (j - 1 )) / (j));
660661 return coefficients;
661662}
662663
@@ -764,8 +765,8 @@ mlir::presburger::detail::computeNumTerms(const GeneratingFunction &gf) {
764765 eachTermDenCoefficients.reserve (r);
765766 for (const Fraction &den : dens) {
766767 singleTermDenCoefficients = getBinomialCoefficients (den + 1 , den + 1 );
767- eachTermDenCoefficients.push_back (
768- ArrayRef<Fraction>(singleTermDenCoefficients).slice ( 1 ));
768+ eachTermDenCoefficients.emplace_back (
769+ ArrayRef<Fraction>(singleTermDenCoefficients).drop_front ( ));
769770 }
770771
771772 // Now we find the coefficients in Q(s) itself
0 commit comments