[Mlir-commits] [mlir] 497f87b - NFC: Silence unused function 'scaleAndAdd' in release build.

Stella Laurenzo llvmlistbot at llvm.org
Thu Apr 7 21:19:30 PDT 2022


Author: Stella Laurenzo
Date: 2022-04-07T21:19:19-07:00
New Revision: 497f87bb7b4f72da52d58ce8016ebe1537b8b2c0

URL: https://github.com/llvm/llvm-project/commit/497f87bb7b4f72da52d58ce8016ebe1537b8b2c0
DIFF: https://github.com/llvm/llvm-project/commit/497f87bb7b4f72da52d58ce8016ebe1537b8b2c0.diff

LOG: NFC: Silence unused function 'scaleAndAdd' in release build.

Differential Revision: https://reviews.llvm.org/D123354

Added: 
    

Modified: 
    mlir/lib/Analysis/Presburger/Simplex.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index f3bf42f40b177..7a65730fbf20e 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<int>::max();
 
+// Return a + scale*b;
+LLVM_ATTRIBUTE_UNUSED
+static SmallVector<int64_t, 8>
+scaleAndAddForAssert(ArrayRef<int64_t> a, int64_t scale, ArrayRef<int64_t> b) {
+  assert(a.size() == b.size());
+  SmallVector<int64_t, 8> 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 @@ class presburger::GBRSimplex {
   SmallVector<unsigned, 8> snapshotStack;
 };
 
-// Return a + scale*b;
-static SmallVector<int64_t, 8> scaleAndAdd(ArrayRef<int64_t> a, int64_t scale,
-                                           ArrayRef<int64_t> b) {
-  assert(a.size() == b.size());
-  SmallVector<int64_t, 8> 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!");
 


        


More information about the Mlir-commits mailing list