[Mlir-commits] [mlir] [mlir][LLVM] Add the `ConvertToLLVMAttrInterface` and `ConvertToLLVMOpInterface` interfaces (PR #99566)

Fabian Mora llvmlistbot at llvm.org
Fri Jul 26 17:00:45 PDT 2024


================
@@ -104,20 +99,33 @@ class ConvertToLLVMPass
         auto *iface = dyn_cast<ConvertToLLVMPatternInterface>(dialect);
         if (!iface)
           continue;
-        iface->populateConvertToLLVMConversionPatterns(*target, *typeConverter,
-                                                       tempPatterns);
+        interfaces->push_back(iface);
       }
     }
 
-    this->patterns =
-        std::make_unique<FrozenRewritePatternSet>(std::move(tempPatterns));
-    this->target = target;
-    this->typeConverter = typeConverter;
+    this->interfaces = interfaces;
     return success();
   }
 
   void runOnOperation() final {
-    if (failed(applyPartialConversion(getOperation(), *target, *patterns)))
+    MLIRContext *context = &getContext();
+    RewritePatternSet patterns(context);
+    ConversionTarget target(*context);
+    target.addLegalDialect<LLVM::LLVMDialect>();
+    LLVMTypeConverter typeConverter(context);
----------------
fabianmcg wrote:

I can think 2 solutions to this issue with little to no performance impact. 
Create a new `convert-to-llvm` like pass, where we say the performance cost doesn't matter. 
Make `ConversionTarget`, `TypeConverter` and `RewritePatternSet` somewhat copyable.

https://github.com/llvm/llvm-project/pull/99566


More information about the Mlir-commits mailing list