@@ -1932,7 +1932,7 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
1932
1932
// element in the vector. Start with an undef vector. Insert the value into
1933
1933
// the first element. Then use a `shufflevector` with a mask of all 0 to
1934
1934
// fill out the entire vector with that value.
1935
- const auto vecTy = mlir::cast<cir::VectorType>( op.getType () );
1935
+ const cir::VectorType vecTy = op.getType ();
1936
1936
const mlir::Type llvmTy = typeConverter->convertType (vecTy);
1937
1937
const mlir::Location loc = op.getLoc ();
1938
1938
const mlir::Value poison = rewriter.create <mlir::LLVM::PoisonOp>(loc, llvmTy);
@@ -1950,20 +1950,16 @@ mlir::LogicalResult CIRToLLVMVecSplatOpLowering::matchAndRewrite(
1950
1950
if (auto intAttr = dyn_cast<mlir::IntegerAttr>(constValue.getValue ())) {
1951
1951
mlir::DenseIntElementsAttr denseVec = mlir::DenseIntElementsAttr::get (
1952
1952
mlir::cast<mlir::ShapedType>(llvmTy), intAttr.getValue ());
1953
-
1954
- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1955
- loc, denseVec.getType (), denseVec);
1956
- rewriter.replaceOp (op, indexValue);
1953
+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1954
+ op, denseVec.getType (), denseVec);
1957
1955
return mlir::success ();
1958
1956
}
1959
1957
1960
1958
if (auto fpAttr = dyn_cast<mlir::FloatAttr>(constValue.getValue ())) {
1961
1959
mlir::DenseFPElementsAttr denseVec = mlir::DenseFPElementsAttr::get (
1962
1960
mlir::cast<mlir::ShapedType>(llvmTy), fpAttr.getValue ());
1963
-
1964
- const mlir::Value indexValue = rewriter.create <mlir::LLVM::ConstantOp>(
1965
- loc, denseVec.getType (), denseVec);
1966
- rewriter.replaceOp (op, indexValue);
1961
+ rewriter.replaceOpWithNewOp <mlir::LLVM::ConstantOp>(
1962
+ op, denseVec.getType (), denseVec);
1967
1963
return mlir::success ();
1968
1964
}
1969
1965
}
0 commit comments