diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp --- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -4243,11 +4243,8 @@ } // Swap the tensor::ExtractSliceOp in front of the vector::TransferWriteOp. - SmallVector newResultShape = applyPermutationMap( - transferOp.getPermutationMap(), insertOp.getSourceType().getShape()); - SmallVector newInBounds; - for (const auto &en : enumerate(newResultShape)) - newInBounds.push_back(en.value() == vectorShape[en.index()]); + // Set all in_bounds to false and let the folder infer them. + SmallVector newInBounds(vectorShape.size(), false); auto newExtractOp = rewriter.create( extractOp.getLoc(), insertOp.getSourceType(), insertOp.getDest(), insertOp.getMixedOffsets(), insertOp.getMixedSizes(),