[Mlir-commits] [mlir] [mlir][vector] Add `vector.from_elements` op (PR #95938)

Guray Ozen llvmlistbot at llvm.org
Tue Jun 18 09:55:10 PDT 2024


================
@@ -1836,6 +1836,34 @@ struct VectorDeinterleaveOpLowering
   }
 };
 
+/// Conversion pattern for a `vector.from_elements`.
+struct VectorFromElementsLowering
+    : public ConvertOpToLLVMPattern<vector::FromElementsOp> {
+  using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
+
+  LogicalResult
+  matchAndRewrite(vector::FromElementsOp fromElementsOp, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    Location loc = fromElementsOp.getLoc();
+    VectorType vectorType = fromElementsOp.getType();
+    // TODO: Multi-dimensional vectors lower to !llvm.array<... x vector<>>.
+    // Such ops should be handled in the same way as vector.insert.
+    if (vectorType.getRank() > 1)
----------------
grypp wrote:

Does it make sense to put this into the verifier?

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


More information about the Mlir-commits mailing list