inkwell
inkwell copied to clipboard
`add_function_inlining_pass` segfaults
I'm playing around with running the pass manager on my code. The default passes from the kaleidoscope example all seem to work well. As soon as I add add_function_inlining_pass it segfaults immediately.
Code
let llvm_context = Context::create();
let module = llvm_context.create_module("module");
module.verify().unwrap();
let pm: PassManager<FunctionValue> = inkwell::passes::PassManager::create(&module);
pm.add_function_inlining_pass();
Result
Segmentation fault (core dumped)
Version
inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm13-0"] }
OS is Ubuntu 21.10
a guess: you make a FunctionValue passmanager, but add_function_inlining_pass is pass that only works on modules, not on individual functions.
It would be great to have more type safety here, because for most passes it's actually unclear what they operate on. Many seem to work (that is, don't segfault) for either, but do they actually do something useful? it's unclear.