|
32 | 32 | #include "mlir/IR/BuiltinTypes.h" |
33 | 33 | #include "mlir/Pass/Pass.h" |
34 | 34 | #include "mlir/Pass/PassManager.h" |
| 35 | +#include "mlir/Support/LogicalResult.h" |
35 | 36 | #include "mlir/Target/LLVMIR/Dialect/Builtin/BuiltinToLLVMIRTranslation.h" |
36 | 37 | #include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h" |
37 | 38 | #include "mlir/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.h" |
@@ -208,6 +209,18 @@ class CIRCosOpLowering : public mlir::OpConversionPattern<mlir::cir::CosOp> { |
208 | 209 | } |
209 | 210 | }; |
210 | 211 |
|
| 212 | +class CIRSinOpLowering : public mlir::OpConversionPattern<mlir::cir::SinOp> { |
| 213 | +public: |
| 214 | + using mlir::OpConversionPattern<mlir::cir::SinOp>::OpConversionPattern; |
| 215 | + |
| 216 | + mlir::LogicalResult |
| 217 | + matchAndRewrite(mlir::cir::SinOp op, OpAdaptor adaptor, |
| 218 | + mlir::ConversionPatternRewriter &rewriter) const override { |
| 219 | + rewriter.replaceOpWithNewOp<mlir::math::SinOp>(op, adaptor.getSrc()); |
| 220 | + return mlir::LogicalResult::success(); |
| 221 | + } |
| 222 | +}; |
| 223 | + |
211 | 224 | class CIRConstantOpLowering |
212 | 225 | : public mlir::OpConversionPattern<mlir::cir::ConstantOp> { |
213 | 226 | public: |
@@ -987,14 +1000,14 @@ void populateCIRToMLIRConversionPatterns(mlir::RewritePatternSet &patterns, |
987 | 1000 | mlir::TypeConverter &converter) { |
988 | 1001 | patterns.add<CIRReturnLowering, CIRBrOpLowering>(patterns.getContext()); |
989 | 1002 |
|
990 | | - patterns |
991 | | - .add<CIRCmpOpLowering, CIRCallOpLowering, CIRUnaryOpLowering, |
992 | | - CIRBinOpLowering, CIRLoadOpLowering, CIRConstantOpLowering, |
993 | | - CIRStoreOpLowering, CIRAllocaOpLowering, CIRFuncOpLowering, |
994 | | - CIRScopeOpLowering, CIRBrCondOpLowering, CIRTernaryOpLowering, |
995 | | - CIRYieldOpLowering, CIRCosOpLowering, CIRGlobalOpLowering, |
996 | | - CIRGetGlobalOpLowering, CIRCastOpLowering, CIRPtrStrideOpLowering>( |
997 | | - converter, patterns.getContext()); |
| 1003 | + patterns.add<CIRCmpOpLowering, CIRCallOpLowering, CIRUnaryOpLowering, |
| 1004 | + CIRBinOpLowering, CIRLoadOpLowering, CIRConstantOpLowering, |
| 1005 | + CIRStoreOpLowering, CIRAllocaOpLowering, CIRFuncOpLowering, |
| 1006 | + CIRScopeOpLowering, CIRBrCondOpLowering, CIRTernaryOpLowering, |
| 1007 | + CIRYieldOpLowering, CIRCosOpLowering, CIRGlobalOpLowering, |
| 1008 | + CIRGetGlobalOpLowering, CIRCastOpLowering, |
| 1009 | + CIRPtrStrideOpLowering, CIRSinOpLowering>(converter, |
| 1010 | + patterns.getContext()); |
998 | 1011 | } |
999 | 1012 |
|
1000 | 1013 | static mlir::TypeConverter prepareTypeConverter() { |
|
0 commit comments