================ @@ -1685,6 +1686,29 @@ mlir::LogicalResult CIRToLLVMStackRestoreOpLowering::matchAndRewrite( return mlir::success(); } +mlir::LogicalResult CIRToLLVMVecCreateOpLowering::matchAndRewrite( + cir::VecCreateOp op, OpAdaptor adaptor, + mlir::ConversionPatternRewriter &rewriter) const { + // Start with an 'undef' value for the vector. Then 'insertelement' for + // each of the vector elements. + const auto vecTy = mlir::cast<cir::VectorType>(op.getType()); + const mlir::Type llvmTy = typeConverter->convertType(vecTy); + const mlir::Location loc = op.getLoc(); + mlir::Value result = rewriter.create<mlir::LLVM::PoisonOp>(loc, llvmTy); + assert(vecTy.getSize() == op.getElements().size() && + "cir.vec.create op count doesn't match vector type elements count"); + + for (uint64_t i = 0; i < vecTy.getSize(); ++i) { ---------------- AmrDeveloper wrote:
I addressed all comments except this one :D, To use `llvm::StoreOp` we need to construct `mlir::DenseElementsAttr`, and it takes `Array<Attribute>`, but we have `Array<Value>` for Constant values. it's easy to get the attribute from them using getDefiningOp but now what is needed is to get value from non constant value for example x in `{ 1, 2, X, 3}` https://github.com/llvm/llvm-project/pull/138107 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits