Skip to content

Commit 497f87b

Browse files
NFC: Silence unused function 'scaleAndAdd' in release build.
Differential Revision: https://reviews.llvm.org/D123354
1 parent 5286c7a commit 497f87b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

mlir/lib/Analysis/Presburger/Simplex.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "mlir/Analysis/Presburger/Matrix.h"
1111
#include "mlir/Support/MathExtras.h"
1212
#include "llvm/ADT/Optional.h"
13+
#include "llvm/Support/Compiler.h"
1314

1415
using namespace mlir;
1516
using namespace presburger;
@@ -18,6 +19,18 @@ using Direction = Simplex::Direction;
1819

1920
const int nullIndex = std::numeric_limits<int>::max();
2021

22+
// Return a + scale*b;
23+
LLVM_ATTRIBUTE_UNUSED
24+
static SmallVector<int64_t, 8>
25+
scaleAndAddForAssert(ArrayRef<int64_t> a, int64_t scale, ArrayRef<int64_t> b) {
26+
assert(a.size() == b.size());
27+
SmallVector<int64_t, 8> res;
28+
res.reserve(a.size());
29+
for (unsigned i = 0, e = a.size(); i < e; ++i)
30+
res.push_back(a[i] + scale * b[i]);
31+
return res;
32+
}
33+
2134
SimplexBase::SimplexBase(unsigned nVar, bool mustUseBigM, unsigned symbolOffset,
2235
unsigned nSymbol)
2336
: usingBigM(mustUseBigM), nRow(0), nCol(getNumFixedCols() + nVar),
@@ -1717,17 +1730,6 @@ class presburger::GBRSimplex {
17171730
SmallVector<unsigned, 8> snapshotStack;
17181731
};
17191732

1720-
// Return a + scale*b;
1721-
static SmallVector<int64_t, 8> scaleAndAdd(ArrayRef<int64_t> a, int64_t scale,
1722-
ArrayRef<int64_t> b) {
1723-
assert(a.size() == b.size());
1724-
SmallVector<int64_t, 8> res;
1725-
res.reserve(a.size());
1726-
for (unsigned i = 0, e = a.size(); i < e; ++i)
1727-
res.push_back(a[i] + scale * b[i]);
1728-
return res;
1729-
}
1730-
17311733
/// Reduce the basis to try and find a direction in which the polytope is
17321734
/// "thin". This only works for bounded polytopes.
17331735
///
@@ -1845,11 +1847,11 @@ void Simplex::reduceBasis(Matrix &basis, unsigned level) {
18451847
// computed value of u is really the minimizer.
18461848

18471849
// Check the value at u - 1.
1848-
assert(gbrSimplex.computeWidth(scaleAndAdd(
1850+
assert(gbrSimplex.computeWidth(scaleAndAddForAssert(
18491851
basis.getRow(i + 1), -1, basis.getRow(i))) >= widthI[j] &&
18501852
"Computed u value does not minimize the width!");
18511853
// Check the value at u + 1.
1852-
assert(gbrSimplex.computeWidth(scaleAndAdd(
1854+
assert(gbrSimplex.computeWidth(scaleAndAddForAssert(
18531855
basis.getRow(i + 1), +1, basis.getRow(i))) >= widthI[j] &&
18541856
"Computed u value does not minimize the width!");
18551857

0 commit comments

Comments
 (0)