[Mlir-commits] [mlir] [mlir] Move vector.{to_elements, from_elements} unrolling to `VectorUnroll.cpp` (PR #159118)
    Erick Ochoa Lopez 
    llvmlistbot at llvm.org
       
    Wed Sep 17 10:10:24 PDT 2025
    
    
  
================
@@ -809,6 +810,82 @@ struct UnrollBroadcastPattern : public OpRewritePattern<vector::BroadcastOp> {
   vector::UnrollVectorOptions options;
 };
 
+struct UnrollToElements final : public OpRewritePattern<vector::ToElementsOp> {
+  UnrollToElements(MLIRContext *context,
+                   const vector::UnrollVectorOptions &options,
+                   PatternBenefit benefit = 1)
+      : OpRewritePattern<vector::ToElementsOp>(context, benefit),
+        options(options) {}
+
+  LogicalResult matchAndRewrite(vector::ToElementsOp op,
+                                PatternRewriter &rewriter) const override {
+
+    TypedValue<VectorType> source = op.getSource();
+    FailureOr<SmallVector<Value>> result =
+        vector::unrollVectorValue(source, rewriter);
+    if (failed(result)) {
+      return failure();
+    }
+    SmallVector<Value> vectors = *result;
+
+    SmallVector<Value> results;
+    for (const Value &vector : vectors) {
----------------
amd-eochoalo wrote:
https://github.com/llvm/llvm-project/pull/159118/commits/5a266fbbfc6977b8f8bf21234133f2a4b30c45c5
https://github.com/llvm/llvm-project/pull/159118
    
    
More information about the Mlir-commits
mailing list