[clang] [CIR] Upstream local initialization for VectorType (PR #138107)
Amr Hesham via cfe-commits
cfe-commits at lists.llvm.org
Fri May 2 10:07:28 PDT 2025
================
@@ -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 will try to see if i can pass the values to StoreOp and use it
https://github.com/llvm/llvm-project/pull/138107
More information about the cfe-commits
mailing list