[Mlir-commits] [mlir] 9a29d87 - [mlir][sparse] Add checking parent op of SortOp
Alex Zinenko
llvmlistbot at llvm.org
Mon Feb 27 07:37:10 PST 2023
Author: Kohei Yamaguchi
Date: 2023-02-27T16:37:02+01:00
New Revision: 9a29d87538842a29b430c6956a4f914896643691
URL: https://github.com/llvm/llvm-project/commit/9a29d87538842a29b430c6956a4f914896643691
DIFF: https://github.com/llvm/llvm-project/commit/9a29d87538842a29b430c6956a4f914896643691.diff
LOG: [mlir][sparse] Add checking parent op of SortOp
Fix crash with segmentation fault caused by setting a parent operator
that is not func::FuncOp with sparse_tensor SortOp.
fixes https://github.com/llvm/llvm-project/issues/59988
Reviewed By: aartbik, wrengr
Differential Revision: https://reviews.llvm.org/D143874
Added:
Modified:
mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index 3e6157001266f..107d9ef7569b0 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -1160,6 +1160,9 @@ LogicalResult matchAndRewriteSortOp(OpTy op, ValueRange xys, uint64_t nx,
}
auto insertPoint = op->template getParentOfType<func::FuncOp>();
+ if (!insertPoint)
+ return failure();
+
SmallString<32> funcName;
FuncGeneratorType funcGenerator;
uint32_t nTrailingP = 0;
More information about the Mlir-commits
mailing list