[Mlir-commits] [mlir] f05b0af - [mlir] Change ComplexToLLVM to be a generic pass

River Riddle llvmlistbot at llvm.org
Tue Mar 8 12:29:09 PST 2022


Author: River Riddle
Date: 2022-03-08T12:25:32-08:00
New Revision: f05b0afa7938cad27897b0b4ecaf875fbe90b524

URL: https://github.com/llvm/llvm-project/commit/f05b0afa7938cad27897b0b4ecaf875fbe90b524
DIFF: https://github.com/llvm/llvm-project/commit/f05b0afa7938cad27897b0b4ecaf875fbe90b524.diff

LOG: [mlir] Change ComplexToLLVM to be a generic pass

It is currently a module pass, but shouldn't be. All of the patterns
are local conversions, and don't require anything about
functions/modules.

Differential Revision: https://reviews.llvm.org/D121192

Added: 
    

Modified: 
    mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
    mlir/include/mlir/Conversion/Passes.td
    mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
index b7f10ad07045a..4869906d2d357 100644
--- a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
+++ b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h
@@ -12,9 +12,7 @@
 
 namespace mlir {
 class LLVMTypeConverter;
-class ModuleOp;
-template <typename T>
-class OperationPass;
+class Pass;
 class RewritePatternSet;
 
 class ComplexStructBuilder : public StructBuilder {
@@ -41,7 +39,7 @@ void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter,
                                              RewritePatternSet &patterns);
 
 /// Create a pass to convert Complex operations to the LLVMIR dialect.
-std::unique_ptr<OperationPass<ModuleOp>> createConvertComplexToLLVMPass();
+std::unique_ptr<Pass> createConvertComplexToLLVMPass();
 
 } // namespace mlir
 

diff  --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index f4d0d274d98a7..bdef5615ff2a1 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -174,7 +174,7 @@ def ConvertBufferizationToMemRef : Pass<"convert-bufferization-to-memref"> {
 // ComplexToLLVM
 //===----------------------------------------------------------------------===//
 
-def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm", "ModuleOp"> {
+def ConvertComplexToLLVM : Pass<"convert-complex-to-llvm"> {
   let summary = "Convert Complex dialect to LLVM dialect";
   let constructor = "mlir::createConvertComplexToLLVMPass()";
   let dependentDialects = ["LLVM::LLVMDialect"];

diff  --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
index 6886eb5db89b7..820086e6d2ba9 100644
--- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
+++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp
@@ -324,21 +324,18 @@ struct ConvertComplexToLLVMPass
 } // namespace
 
 void ConvertComplexToLLVMPass::runOnOperation() {
-  auto module = getOperation();
-
   // Convert to the LLVM IR dialect using the converter defined above.
   RewritePatternSet patterns(&getContext());
   LLVMTypeConverter converter(&getContext());
   populateComplexToLLVMConversionPatterns(converter, patterns);
 
   LLVMConversionTarget target(getContext());
-  target.addLegalOp<ModuleOp, FuncOp>();
   target.addIllegalDialect<complex::ComplexDialect>();
-  if (failed(applyPartialConversion(module, target, std::move(patterns))))
+  if (failed(
+          applyPartialConversion(getOperation(), target, std::move(patterns))))
     signalPassFailure();
 }
 
-std::unique_ptr<OperationPass<ModuleOp>>
-mlir::createConvertComplexToLLVMPass() {
+std::unique_ptr<Pass> mlir::createConvertComplexToLLVMPass() {
   return std::make_unique<ConvertComplexToLLVMPass>();
 }


        


More information about the Mlir-commits mailing list