Skip to content

Commit 2db8b94

Browse files
committed
Apply clang-tidy fixes for performance-unnecessary-value-param in Barvinok.cpp (NFC)
1 parent 9915418 commit 2db8b94

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

mlir/include/mlir/Analysis/Presburger/Barvinok.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ inline PolyhedronH defineHRep(int numVars, int numSymbols = 0) {
7474
/// Barvinok, A., and J. E. Pommersheim. "An algorithmic theory of lattice
7575
/// points in polyhedra." p. 107 If it has more rays than the dimension, return
7676
/// 0.
77-
MPInt getIndex(ConeV cone);
77+
MPInt getIndex(const ConeV &cone);
7878

7979
/// Given a cone in H-representation, return its dual. The dual cone is in
8080
/// V-representation.
@@ -91,7 +91,7 @@ ConeH getDual(ConeV cone);
9191
/// The input cone must be unimodular; it assert-fails otherwise.
9292
GeneratingFunction computeUnimodularConeGeneratingFunction(ParamPoint vertex,
9393
int sign,
94-
ConeH cone);
94+
const ConeH &cone);
9595

9696
/// Find the solution of a set of equations that express affine constraints
9797
/// between a set of variables and a set of parameters. The solution expresses

mlir/lib/Analysis/Presburger/Barvinok.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ConeH mlir::presburger::detail::getDual(ConeV cone) {
6161
}
6262

6363
/// Find the index of a cone in V-representation.
64-
MPInt mlir::presburger::detail::getIndex(ConeV cone) {
64+
MPInt mlir::presburger::detail::getIndex(const ConeV &cone) {
6565
if (cone.getNumRows() > cone.getNumColumns())
6666
return MPInt(0);
6767

@@ -79,7 +79,7 @@ MPInt mlir::presburger::detail::getIndex(ConeV cone) {
7979
/// coefficients.
8080
GeneratingFunction
8181
mlir::presburger::detail::computeUnimodularConeGeneratingFunction(
82-
ParamPoint vertex, int sign, ConeH cone) {
82+
ParamPoint vertex, int sign, const ConeH &cone) {
8383
// Consider a cone with H-representation [0 -1].
8484
// [-1 -2]
8585
// Let the vertex be given by the matrix [ 2 2 0], with 2 params.
@@ -556,8 +556,8 @@ QuasiPolynomial mlir::presburger::detail::getCoefficientInRationalFunction(
556556
/// v represents the affine functions whose floors are multiplied by the
557557
/// generators, and ds represents the list of generators.
558558
std::pair<QuasiPolynomial, std::vector<Fraction>>
559-
substituteMuInTerm(unsigned numParams, ParamPoint v, std::vector<Point> ds,
560-
Point mu) {
559+
substituteMuInTerm(unsigned numParams, const ParamPoint &v,
560+
const std::vector<Point> &ds, const Point &mu) {
561561
unsigned numDims = mu.size();
562562
#ifndef NDEBUG
563563
for (const Point &d : ds)
@@ -635,7 +635,7 @@ void normalizeDenominatorExponents(int &sign, QuasiPolynomial &num,
635635

636636
/// Compute the binomial coefficients nCi for 0 ≤ i ≤ r,
637637
/// where n is a QuasiPolynomial.
638-
std::vector<QuasiPolynomial> getBinomialCoefficients(QuasiPolynomial n,
638+
std::vector<QuasiPolynomial> getBinomialCoefficients(const QuasiPolynomial &n,
639639
unsigned r) {
640640
unsigned numParams = n.getNumInputs();
641641
std::vector<QuasiPolynomial> coefficients;
@@ -652,7 +652,8 @@ std::vector<QuasiPolynomial> getBinomialCoefficients(QuasiPolynomial n,
652652

653653
/// Compute the binomial coefficients nCi for 0 ≤ i ≤ r,
654654
/// where n is a QuasiPolynomial.
655-
std::vector<Fraction> getBinomialCoefficients(Fraction n, Fraction r) {
655+
std::vector<Fraction> getBinomialCoefficients(const Fraction &n,
656+
const Fraction &r) {
656657
std::vector<Fraction> coefficients;
657658
coefficients.reserve((int64_t)floor(r));
658659
coefficients.emplace_back(1);

0 commit comments

Comments
 (0)