Skip to content

Commit

Permalink
Apply clang-tidy fixes for performance-unnecessary-value-param in Bar…
Browse files Browse the repository at this point in the history
…vinok.cpp (NFC)
  • Loading branch information
joker-eph committed Mar 5, 2024
1 parent 9915418 commit 2db8b94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions mlir/include/mlir/Analysis/Presburger/Barvinok.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ inline PolyhedronH defineHRep(int numVars, int numSymbols = 0) {
/// Barvinok, A., and J. E. Pommersheim. "An algorithmic theory of lattice
/// points in polyhedra." p. 107 If it has more rays than the dimension, return
/// 0.
MPInt getIndex(ConeV cone);
MPInt getIndex(const ConeV &cone);

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

/// Find the solution of a set of equations that express affine constraints
/// between a set of variables and a set of parameters. The solution expresses
Expand Down
13 changes: 7 additions & 6 deletions mlir/lib/Analysis/Presburger/Barvinok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ConeH mlir::presburger::detail::getDual(ConeV cone) {
}

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

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

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

/// Compute the binomial coefficients nCi for 0 ≤ i ≤ r,
/// where n is a QuasiPolynomial.
std::vector<Fraction> getBinomialCoefficients(Fraction n, Fraction r) {
std::vector<Fraction> getBinomialCoefficients(const Fraction &n,
const Fraction &r) {
std::vector<Fraction> coefficients;
coefficients.reserve((int64_t)floor(r));
coefficients.emplace_back(1);
Expand Down

0 comments on commit 2db8b94

Please sign in to comment.