[Mlir-commits] [mlir] [MLIR] Avoid `vector.extract_strided_slice` when not needed (PR #115941)

Jakub Kuderski llvmlistbot at llvm.org
Tue Nov 12 16:59:34 PST 2024


================
@@ -150,6 +150,13 @@ static Value staticallyExtractSubvector(OpBuilder &rewriter, Location loc,
   assert((vectorType.getRank() == 1 && extractType.getRank() == 1) &&
          "expected 1-D source and destination types");
   (void)vectorType;
+  assert(frontOffset + subvecSize <= vectorType.getNumElements() &&
+         "subvector out of bounds");
+
+  // do not need extraction if the subvector size is the same as the source
----------------
kuhar wrote:

nit: Use proper sentences in code comments: https://llvm.org/docs/CodingStandards.html#commenting

https://github.com/llvm/llvm-project/pull/115941


More information about the Mlir-commits mailing list