aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib
diff options
context:
space:
mode:
authorAart Bik <ajcbik@google.com>2022-08-04 11:49:00 -0700
committerAart Bik <ajcbik@google.com>2022-08-04 13:35:13 -0700
commit7f5b16733651c658b8cb4b05f2a3075ce84c3057 (patch)
treeee002eaf97a263f381fcb91b9df19ac7f6413048 /mlir/lib
parent6e45162adfec14ef4f53ec99312cb26d23f929bc (diff)
[mlir][sparse] fix bug in complex zero detection
We were checking real-part twice, not real/imag-part. The new test only passes after the bug fix. Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D131190
Diffstat (limited to 'mlir/lib')
-rw-r--r--mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
index f844987e5a70..6ef79f868f8a 100644
--- a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
@@ -807,7 +807,7 @@ bool Merger::maybeZero(unsigned e) const {
if (auto c = tensorExps[e].val.getDefiningOp<complex::ConstantOp>()) {
ArrayAttr arrayAttr = c.getValue();
return arrayAttr[0].cast<FloatAttr>().getValue().isZero() &&
- arrayAttr[0].cast<FloatAttr>().getValue().isZero();
+ arrayAttr[1].cast<FloatAttr>().getValue().isZero();
}
if (auto c = tensorExps[e].val.getDefiningOp<arith::ConstantIntOp>())
return c.value() == 0;