@@ -230,8 +230,13 @@ struct LinearizeVectorExtractStridedSlice final
230230 extractStridedSliceOp.getType ());
231231 assert (flatOutputType && " vector type expected" );
232232
233- assert (stridesAllOne (extractStridedSliceOp) &&
234- " has extract_strided_slice's verifier not checked strides are 1?" );
233+ // Expect a legalization failure if the strides are not all 1 (if ever the
234+ // verifier for extract_strided_slice allows non-1 strides).
235+ if (!stridesAllOne (extractStridedSliceOp)) {
236+ return rewriter.notifyMatchFailure (
237+ extractStridedSliceOp,
238+ " extract_strided_slice with strides != 1 not supported" );
239+ }
235240
236241 FailureOr<SmallVector<int64_t >> offsets =
237242 intsFromArrayAttr (extractStridedSliceOp.getOffsets ());
@@ -292,9 +297,13 @@ struct LinearizeVectorInsertStridedSlice final
292297 OpAdaptor adaptor,
293298 ConversionPatternRewriter &rewriter) const override {
294299
295- // See InsertStridedSliceOp's verify method.
296- assert (stridesAllOne (insertStridedSliceOp) &&
297- " has insert_strided_slice's verifier not checked strides are 1?" );
300+ // Expect a legalization failure if the strides are not all 1 (if ever the
301+ // verifier for insert_strided_slice allows non-1 strides).
302+ if (!stridesAllOne (insertStridedSliceOp)) {
303+ return rewriter.notifyMatchFailure (
304+ insertStridedSliceOp,
305+ " insert_strided_slice with strides != 1 not supported" );
306+ }
298307
299308 VectorType inputType = insertStridedSliceOp.getValueToStore ().getType ();
300309 ArrayRef<int64_t > inputShape = inputType.getShape ();
0 commit comments