diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -1703,8 +1703,8 @@ if (extract.indices().size() != 1) return failure(); - auto tensor_from_elements = - dyn_cast(extract.aggregate().getDefiningOp()); + auto tensor_from_elements = dyn_cast_or_null( + extract.aggregate().getDefiningOp()); if (tensor_from_elements == nullptr) return failure();