From 497f87bb7b4f72da52d58ce8016ebe1537b8b2c0 Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Thu, 7 Apr 2022 20:26:20 -0700 Subject: [PATCH] NFC: Silence unused function 'scaleAndAdd' in release build. Differential Revision: https://reviews.llvm.org/D123354 --- mlir/lib/Analysis/Presburger/Simplex.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp index f3bf42f..7a65730 100644 --- a/mlir/lib/Analysis/Presburger/Simplex.cpp +++ b/mlir/lib/Analysis/Presburger/Simplex.cpp @@ -10,6 +10,7 @@ #include "mlir/Analysis/Presburger/Matrix.h" #include "mlir/Support/MathExtras.h" #include "llvm/ADT/Optional.h" +#include "llvm/Support/Compiler.h" using namespace mlir; using namespace presburger; @@ -18,6 +19,18 @@ using Direction = Simplex::Direction; const int nullIndex = std::numeric_limits::max(); +// Return a + scale*b; +LLVM_ATTRIBUTE_UNUSED +static SmallVector +scaleAndAddForAssert(ArrayRef a, int64_t scale, ArrayRef b) { + assert(a.size() == b.size()); + SmallVector res; + res.reserve(a.size()); + for (unsigned i = 0, e = a.size(); i < e; ++i) + res.push_back(a[i] + scale * b[i]); + return res; +} + SimplexBase::SimplexBase(unsigned nVar, bool mustUseBigM, unsigned symbolOffset, unsigned nSymbol) : usingBigM(mustUseBigM), nRow(0), nCol(getNumFixedCols() + nVar), @@ -1717,17 +1730,6 @@ private: SmallVector snapshotStack; }; -// Return a + scale*b; -static SmallVector scaleAndAdd(ArrayRef a, int64_t scale, - ArrayRef b) { - assert(a.size() == b.size()); - SmallVector res; - res.reserve(a.size()); - for (unsigned i = 0, e = a.size(); i < e; ++i) - res.push_back(a[i] + scale * b[i]); - return res; -} - /// Reduce the basis to try and find a direction in which the polytope is /// "thin". This only works for bounded polytopes. /// @@ -1845,11 +1847,11 @@ void Simplex::reduceBasis(Matrix &basis, unsigned level) { // computed value of u is really the minimizer. // Check the value at u - 1. - assert(gbrSimplex.computeWidth(scaleAndAdd( + assert(gbrSimplex.computeWidth(scaleAndAddForAssert( basis.getRow(i + 1), -1, basis.getRow(i))) >= widthI[j] && "Computed u value does not minimize the width!"); // Check the value at u + 1. - assert(gbrSimplex.computeWidth(scaleAndAdd( + assert(gbrSimplex.computeWidth(scaleAndAddForAssert( basis.getRow(i + 1), +1, basis.getRow(i))) >= widthI[j] && "Computed u value does not minimize the width!"); -- 2.7.4