@@ -1892,7 +1892,7 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
1892
1892
// element in the vector. Start with an undef vector. Insert the value into
1893
1893
// the first element. Then use a `shufflevector` with a mask of all 0 to
1894
1894
// fill out the entire vector with that value.
1895
- const auto vecTy = mlir::cast<cir::VectorType>( op.getType () );
1895
+ const cir::VectorType vecTy = op.getType ();
1896
1896
const mlir::Type llvmTy = typeConverter->convertType (vecTy);
1897
1897
const mlir::Location loc = op.getLoc ();
1898
1898
const mlir::Value poison = rewriter.create <mlir::LLVM::PoisonOp>(loc, llvmTy);
@@ -1910,20 +1910,16 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
1910
1910
if (auto intAttr = dyn_cast<mlir::IntegerAttr>(constValue.getValue ())) {
1911
1911
mlir::DenseIntElementsAttr denseVec = mlir::DenseIntElementsAttr::get (
1912
1912
mlir::cast<mlir::ShapedType>(llvmTy), intAttr.getValue ());
1913
-
1914
- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1915
- loc, denseVec.getType (), denseVec);
1916
- rewriter.replaceOp (op, indexValue);
1913
+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1914
+ op, denseVec.getType (), denseVec);
1917
1915
return mlir::success ();
1918
1916
}
1919
1917
1920
1918
if (auto fpAttr = dyn_cast<mlir::FloatAttr>(constValue.getValue ())) {
1921
1919
mlir::DenseFPElementsAttr denseVec = mlir::DenseFPElementsAttr::get (
1922
1920
mlir::cast<mlir::ShapedType>(llvmTy), fpAttr.getValue ());
1923
-
1924
- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1925
- loc, denseVec.getType (), denseVec);
1926
- rewriter.replaceOp (op, indexValue);
1921
+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1922
+ op, denseVec.getType (), denseVec);
1927
1923
return mlir::success ();
1928
1924
}
1929
1925
}
0 commit comments