[Mlir-commits] [mlir] [mlir][sparse] fix unused variable warning on release build (PR #68824)
Peiming Liu
llvmlistbot at llvm.org
Wed Oct 11 10:41:35 PDT 2023
https://github.com/PeimingLiu created https://github.com/llvm/llvm-project/pull/68824
None
>From 77ec836420db438b5fe4e9aa9de78cb6fabb0e8a Mon Sep 17 00:00:00 2001
From: Peiming Liu <peiming at google.com>
Date: Wed, 11 Oct 2023 17:30:46 +0000
Subject: [PATCH] [mlir][sparse] fix unused variable warning on release build
---
.../lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp | 2 ++
.../Dialect/SparseTensor/Transforms/StageSparseOperations.cpp | 2 ++
2 files changed, 4 insertions(+)
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
index fdecfe303d31351..78f5562b392a682 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
@@ -710,6 +710,8 @@ struct SparseSortCOOConverter : public OpConversionPattern<ConvertOp> {
// Otherwise we need another data shuffle and a non-identity map.
assert(dstStt.hasSameDimToLvl(srcStt));
+ (void)dstStt; // to silence warning when assertion is disabled
+
auto id = AffineMap::getMultiDimIdentityMap(srcStt.getLvlRank(), ctx);
rewriter.create<SortOp>(loc, nnz, crd, ValueRange{val}, id,
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp
index 60ac71de4dd71ca..4ab4b05a7a420c7 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp
@@ -36,6 +36,8 @@ struct StageUnorderedConvert : public OpRewritePattern<ConvertOp> {
// source -> coo
// The tmp COO must be unordered, otherwise it is a direct conversion.
assert(!(srcStt.hasSameDimToLvl(dstStt) && srcStt.isAllOrdered()));
+ (void)srcStt; // to silence warning when assertion is disabled
+
Type srcCOOTp = getCOOFromTypeWithOrdering(
dstStt.getRankedTensorType(), dstStt.getDimToLvl(), /*ordered=*/false);
Value srcCOO = rewriter.create<ConvertOp>(loc, srcCOOTp, op.getSource());
More information about the Mlir-commits
mailing list