@@ -361,7 +361,7 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(
361
361
continue ;
362
362
// If this subset corresponds to a vertex that has not been considered,
363
363
// store it.
364
- vertices.push_back (*vertex);
364
+ vertices.emplace_back (*vertex);
365
365
366
366
// If a vertex is formed by the intersection of more than d facets, we
367
367
// assume that any d-subset of these facets can be solved to obtain its
@@ -472,10 +472,10 @@ mlir::presburger::detail::computePolytopeGeneratingFunction(
472
472
Point mlir::presburger::detail::getNonOrthogonalVector (
473
473
ArrayRef<Point> vectors) {
474
474
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!" );
479
479
480
480
SmallVector<Fraction> newPoint = {Fraction (1 , 1 )};
481
481
Fraction maxDisallowedValue = -Fraction (1 , 0 ),
@@ -493,7 +493,7 @@ Point mlir::presburger::detail::getNonOrthogonalVector(
493
493
// Find the biggest such value
494
494
maxDisallowedValue = std::max (maxDisallowedValue, disallowedValue);
495
495
}
496
- newPoint.push_back (maxDisallowedValue + 1 );
496
+ newPoint.emplace_back (maxDisallowedValue + 1 );
497
497
}
498
498
return newPoint;
499
499
}
@@ -519,19 +519,20 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
519
519
unsigned numParam = num[0 ].getNumInputs ();
520
520
// We use the `isEqual` method of PresburgerSpace, which QuasiPolynomial
521
521
// 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!" );
526
527
527
528
std::vector<QuasiPolynomial> coefficients;
528
529
coefficients.reserve (power + 1 );
529
530
530
- coefficients.push_back (num[0 ] / den[0 ]);
531
+ coefficients.emplace_back (num[0 ] / den[0 ]);
531
532
for (unsigned i = 1 ; i <= power; ++i) {
532
533
// 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 ));
535
536
536
537
// After den.size(), the coefficients are zero, so we stop
537
538
// subtracting at that point (if it is less than i).
@@ -573,15 +574,15 @@ substituteMuInTerm(unsigned numParams, const ParamPoint &v,
573
574
SmallVector<Fraction> coefficients;
574
575
coefficients.reserve (numDims);
575
576
for (const Point &d : ds)
576
- coefficients.push_back (-dotProduct (mu, d));
577
+ coefficients.emplace_back (-dotProduct (mu, d));
577
578
578
579
// Then, the affine function is a single floor expression, given by the
579
580
// corresponding column of v.
580
581
ParamPoint vTranspose = v.transpose ();
581
582
std::vector<std::vector<SmallVector<Fraction>>> affine;
582
583
affine.reserve (numDims);
583
584
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)} });
585
586
586
587
QuasiPolynomial num (numParams, coefficients, affine);
587
588
num = num.simplify ();
@@ -593,7 +594,7 @@ substituteMuInTerm(unsigned numParams, const ParamPoint &v,
593
594
for (const Point &d : ds) {
594
595
// This term in the denominator is
595
596
// (1 - t^dens.back())
596
- dens.push_back (dotProduct (d, mu));
597
+ dens.emplace_back (dotProduct (d, mu));
597
598
}
598
599
599
600
return {num, dens};
@@ -641,7 +642,7 @@ std::vector<QuasiPolynomial> getBinomialCoefficients(const QuasiPolynomial &n,
641
642
coefficients.emplace_back (numParams, 1 );
642
643
for (unsigned j = 1 ; j <= r; ++j)
643
644
// We use the recursive formula for binomial coefficients here and below.
644
- coefficients.push_back (
645
+ coefficients.emplace_back (
645
646
(coefficients[j - 1 ] * (n - QuasiPolynomial (numParams, j - 1 )) /
646
647
Fraction (j, 1 ))
647
648
.simplify ());
@@ -656,7 +657,7 @@ std::vector<Fraction> getBinomialCoefficients(const Fraction &n,
656
657
coefficients.reserve ((int64_t )floor (r));
657
658
coefficients.emplace_back (1 );
658
659
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));
660
661
return coefficients;
661
662
}
662
663
@@ -764,8 +765,8 @@ mlir::presburger::detail::computeNumTerms(const GeneratingFunction &gf) {
764
765
eachTermDenCoefficients.reserve (r);
765
766
for (const Fraction &den : dens) {
766
767
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 ( ));
769
770
}
770
771
771
772
// Now we find the coefficients in Q(s) itself
0 commit comments