@@ -777,6 +777,18 @@ mlir::LogicalResult CIRToLLVMMemSetOpLowering::matchAndRewrite(
777
777
return mlir::success ();
778
778
}
779
779
780
+ mlir::LogicalResult CIRToLLVMMemSetInlineOpLowering::matchAndRewrite (
781
+ cir::MemSetInlineOp op, OpAdaptor adaptor,
782
+ mlir::ConversionPatternRewriter &rewriter) const {
783
+ auto converted = rewriter.create <mlir::LLVM::TruncOp>(
784
+ op.getLoc (), mlir::IntegerType::get (op.getContext (), 8 ),
785
+ adaptor.getVal ());
786
+ rewriter.replaceOpWithNewOp <mlir::LLVM::MemsetInlineOp>(
787
+ op, adaptor.getDst (), converted, adaptor.getLenAttr (),
788
+ /* isVolatile=*/ false );
789
+ return mlir::success ();
790
+ }
791
+
780
792
static mlir::Value getLLVMIntCast (mlir::ConversionPatternRewriter &rewriter,
781
793
mlir::Value llvmSrc, mlir::Type llvmDstIntTy,
782
794
bool isUnsigned, uint64_t cirSrcWidth,
@@ -1851,8 +1863,8 @@ mlir::LogicalResult CIRToLLVMVAArgOpLowering::matchAndRewrite(
1851
1863
return op.emitError (" cir.vaarg lowering is NYI" );
1852
1864
}
1853
1865
1854
- // / Returns the name used for the linkage attribute. This *must* correspond
1855
- // / to the name of the attribute in ODS.
1866
+ // / Returns the name used for the linkage attribute. This *must* correspond
1867
+ // / to the name of the attribute in ODS.
1856
1868
StringRef CIRToLLVMFuncOpLowering::getLinkageAttrNameString () {
1857
1869
return " linkage" ;
1858
1870
}
@@ -1886,8 +1898,8 @@ void CIRToLLVMFuncOpLowering::lowerFuncAttributes(
1886
1898
}
1887
1899
}
1888
1900
1889
- // / When do module translation, we can only translate LLVM-compatible types.
1890
- // / Here we lower possible OpenCLKernelMetadataAttr to use the converted type.
1901
+ // / When do module translation, we can only translate LLVM-compatible types.
1902
+ // / Here we lower possible OpenCLKernelMetadataAttr to use the converted type.
1891
1903
void CIRToLLVMFuncOpLowering::lowerFuncOpenCLKernelMetadata (
1892
1904
mlir::NamedAttribute &extraAttrsEntry) const {
1893
1905
const auto attrKey = cir::OpenCLKernelMetadataAttr::getMnemonic ();
@@ -2100,8 +2112,8 @@ mlir::LogicalResult CIRToLLVMSwitchFlatOpLowering::matchAndRewrite(
2100
2112
return mlir::success ();
2101
2113
}
2102
2114
2103
- // / Replace CIR global with a region initialized LLVM global and update
2104
- // / insertion point to the end of the initializer block.
2115
+ // / Replace CIR global with a region initialized LLVM global and update
2116
+ // / insertion point to the end of the initializer block.
2105
2117
void CIRToLLVMGlobalOpLowering::setupRegionInitializedLLVMGlobalOp (
2106
2118
cir::GlobalOp op, mlir::ConversionPatternRewriter &rewriter) const {
2107
2119
const auto llvmType = getTypeConverter ()->convertType (op.getSymType ());
@@ -3890,8 +3902,9 @@ void populateCIRToLLVMConversionPatterns(
3890
3902
CIRToLLVMBaseClassAddrOpLowering, CIRToLLVMDerivedClassAddrOpLowering,
3891
3903
CIRToLLVMVTTAddrPointOpLowering, CIRToLLVMIsFPClassOpLowering,
3892
3904
CIRToLLVMAbsOpLowering, CIRToLLVMMemMoveOpLowering,
3893
- CIRToLLVMMemSetOpLowering, CIRToLLVMMemCpyInlineOpLowering,
3894
- CIRToLLVMSignBitOpLowering, CIRToLLVMPtrMaskOpLowering
3905
+ CIRToLLVMMemSetOpLowering, CIRToLLVMMemSetInlineOpLowering,
3906
+ CIRToLLVMMemCpyInlineOpLowering, CIRToLLVMSignBitOpLowering,
3907
+ CIRToLLVMPtrMaskOpLowering
3895
3908
#define GET_BUILTIN_LOWERING_LIST
3896
3909
#include " clang/CIR/Dialect/IR/CIRBuiltinsLowering.inc"
3897
3910
#undef GET_BUILTIN_LOWERING_LIST
0 commit comments