[Mlir-commits] [mlir] [mlir][vector] Fix missed `return` in ExtractStridedSliceOp::fold (PR #165669)

Haocong Lu llvmlistbot at llvm.org
Thu Oct 30 00:56:21 PDT 2025


https://github.com/Luhaocong created https://github.com/llvm/llvm-project/pull/165669

Fix missed `return` when folding splat ConstantOp, it could work well probably because of good compatibility of `foldExtractStridedSliceNonSplatConstant`.

>From 8e022516329dbbd523c83ed99af27a91e1aa3748 Mon Sep 17 00:00:00 2001
From: Haocong Lu <haoconglu at qq.com>
Date: Thu, 30 Oct 2025 15:42:11 +0800
Subject: [PATCH] [mlir][vector] Fix missed `return` in
 ExtractStridedSliceOp::fold

Fix missed `return` when folding splat ConstantOp, it could
work well probably because of good compatibility of
`foldExtractStridedSliceNonSplatConstant`.
---
 mlir/lib/Dialect/Vector/IR/VectorOps.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 45c54c7587c69..cb94e9f92b917 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -4336,7 +4336,7 @@ OpFoldResult ExtractStridedSliceOp::fold(FoldAdaptor adaptor) {
   // ExtractStridedSliceOp(splat ConstantOp) -> ConstantOp.
   if (auto splat =
           llvm::dyn_cast_if_present<SplatElementsAttr>(adaptor.getSource()))
-    DenseElementsAttr::get(getType(), splat.getSplatValue<Attribute>());
+    return DenseElementsAttr::get(getType(), splat.getSplatValue<Attribute>());
 
   // ExtractStridedSliceOp(non-splat ConstantOp) -> ConstantOp.
   return foldExtractStridedSliceNonSplatConstant(*this, adaptor.getSource());



More information about the Mlir-commits mailing list