@@ -1965,7 +1965,7 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
19651965 // element in the vector. Start with an undef vector. Insert the value into
19661966 // the first element. Then use a `shufflevector` with a mask of all 0 to
19671967 // fill out the entire vector with that value.
1968- const auto vecTy = mlir::cast<cir::VectorType>( op.getType () );
1968+ const cir::VectorType vecTy = op.getType ();
19691969 const mlir::Type llvmTy = typeConverter->convertType (vecTy);
19701970 const mlir::Location loc = op.getLoc ();
19711971 const mlir::Value poison = rewriter.create <mlir::LLVM::PoisonOp>(loc, llvmTy);
@@ -1983,20 +1983,16 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
19831983 if (auto intAttr = dyn_cast<mlir::IntegerAttr>(constValue.getValue ())) {
19841984 mlir::DenseIntElementsAttr denseVec = mlir::DenseIntElementsAttr::get (
19851985 mlir::cast<mlir::ShapedType>(llvmTy), intAttr.getValue ());
1986-
1987- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1988- loc, denseVec.getType (), denseVec);
1989- rewriter.replaceOp (op, indexValue);
1986+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1987+ op, denseVec.getType (), denseVec);
19901988 return mlir::success ();
19911989 }
19921990
19931991 if (auto fpAttr = dyn_cast<mlir::FloatAttr>(constValue.getValue ())) {
19941992 mlir::DenseFPElementsAttr denseVec = mlir::DenseFPElementsAttr::get (
19951993 mlir::cast<mlir::ShapedType>(llvmTy), fpAttr.getValue ());
1996-
1997- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1998- loc, denseVec.getType (), denseVec);
1999- rewriter.replaceOp (op, indexValue);
1994+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1995+ op, denseVec.getType (), denseVec);
20001996 return mlir::success ();
20011997 }
20021998 }
0 commit comments