[Mlir-commits] [mlir] [MLIR][Python] expose translate_module_to_llvmir (PR #163881)
Maksim Levental
llvmlistbot at llvm.org
Thu Oct 16 21:22:04 PDT 2025
makslevental wrote:
Note, I added `mlirTranslateModuleToLLVMIRToString` instead of doing something like
```c++
m.def(
"translate_module_to_llvmir",
[](MlirOperation module) {
LLVMContextRef llvmCtx = LLVMContextCreate();
LLVMModuleRef llvmModule = mlirTranslateModuleToLLVMIR(module, llvmCtx);
char *llvmir = LLVMPrintModuleToString(llvmModule);
LLVMDisposeModule(llvmModule);
LLVMContextDispose(llvmCtx);
return llvmir;
},
```
because there seems to be absolutely no way to prevent symbol DCE in the transitive dep MLIRCAPITarget which is the target that actually links `LLVMCore`.
https://github.com/llvm/llvm-project/pull/163881
More information about the Mlir-commits
mailing list