Skip to content

Commit 9a29d87

Browse files
sott0nftynse
authored andcommitted
[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 #59988 Reviewed By: aartbik, wrengr Differential Revision: https://reviews.llvm.org/D143874
1 parent b46e78c commit 9a29d87

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,9 @@ LogicalResult matchAndRewriteSortOp(OpTy op, ValueRange xys, uint64_t nx,
11601160
}
11611161

11621162
auto insertPoint = op->template getParentOfType<func::FuncOp>();
1163+
if (!insertPoint)
1164+
return failure();
1165+
11631166
SmallString<32> funcName;
11641167
FuncGeneratorType funcGenerator;
11651168
uint32_t nTrailingP = 0;

0 commit comments

Comments
 (0)