diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp @@ -1160,6 +1160,9 @@ } auto insertPoint = op->template getParentOfType(); + if (!insertPoint) + return failure(); + SmallString<32> funcName; FuncGeneratorType funcGenerator; uint32_t nTrailingP = 0;