[Mlir-commits] [mlir] [mlir][LLVM] Add the `ConvertToLLVMAttrInterface` and `ConvertToLLVMOpInterface` interfaces (PR #99566)
Fabian Mora
llvmlistbot at llvm.org
Fri Jul 26 16:40:51 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 also thought that could be the case. However, it appears that `initialize` is called every time. I added the pass multiple times in a pipeline and added a print in the initialize method of the method, and the method is called every time. Seems like something to fix in the `PassManager`.
But even then, let's assume that the cost of one vs the other is `thread * N` times greater. If `convert-to-llvm` was a pass like `cse` or `canonicalize` I would 100% agree with you, however, this is a pass that likely won't be invoked that many times.
https://github.com/llvm/llvm-project/pull/99566
More information about the Mlir-commits
mailing list