[MLIR][Standard] Fix use of `dyn_cast_or_null`

The value may be a function argument in which case `getDefiningOp` will return a
`nullptr`.

Differential Revision: https://reviews.llvm.org/D81965
This commit is contained in:
Frederik Gossen 2020-06-16 21:04:57 +00:00
parent 6a5641eff6
commit 6f2943fb19
1 changed files with 2 additions and 2 deletions

View File

@ -1703,8 +1703,8 @@ struct ExtractElementFromTensorFromElements
if (extract.indices().size() != 1)
return failure();
auto tensor_from_elements =
dyn_cast<TensorFromElementsOp>(extract.aggregate().getDefiningOp());
auto tensor_from_elements = dyn_cast_or_null<TensorFromElementsOp>(
extract.aggregate().getDefiningOp());
if (tensor_from_elements == nullptr)
return failure();