diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Transforms/Vectorize.cpp @@ -1003,7 +1003,7 @@ return nullptr; } // 3. vectorize constant. - if (auto constant = dyn_cast(operand.getDefiningOp())) { + if (auto constant = dyn_cast_or_null(operand.getDefiningOp())) { return vectorizeConstant( op, constant, VectorType::get(state->strategy->vectorSizes, operand.getType())); @@ -1037,6 +1037,8 @@ auto memRef = store.getMemRef(); auto value = store.getValueToStore(); auto vectorValue = vectorizeOperand(value, opInst, state); + if (!vectorValue) + return nullptr; ValueRange mapOperands = store.getMapOperands(); SmallVector indices;