[Mlir-commits] [mlir] [mlir][sparse] move variable into assert to avoid 'unused' error (PR #68604)

Aart Bik llvmlistbot at llvm.org
Mon Oct 9 09:03:32 PDT 2023


https://github.com/aartbik created https://github.com/llvm/llvm-project/pull/68604

None

>From 00af5ae3ba3a1a22352f2ce98c7092e128807995 Mon Sep 17 00:00:00 2001
From: Aart Bik <ajcbik at google.com>
Date: Mon, 9 Oct 2023 09:01:02 -0700
Subject: [PATCH] [mlir][sparse] move variable into assert to avoid 'unused'
 error

---
 .../Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
index bb92029ff1e924d..e44d8565fc867de 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
@@ -200,8 +200,7 @@ class NewCallParams final {
   /// MLIR buffers as needed, and returning `this` for method chaining.
   NewCallParams &genBuffers(SparseTensorType stt,
                             ArrayRef<Value> dimSizesValues) {
-    const Dimension dimRank = stt.getDimRank();
-    assert(dimSizesValues.size() == static_cast<size_t>(dimRank));
+    assert(dimSizesValues.size() == static_cast<size_t>(stt.getDimRank()));
     // Sparsity annotations.
     params[kParamLvlTypes] = genLvlTypesBuffer(builder, loc, stt);
     // Construct dimSizes, lvlSizes, dim2lvl, and lvl2dim buffers.



More information about the Mlir-commits mailing list