Re-JITing a Function

Dear LLVMers,

Can the LLVM JIT, at run-time, take a function for which it has already
generated native code, re-optimize it at the LLVM level, and then
re-generate its native code, replacing calls of the old function with
calls to the new function?

I seem to recall that it could, but I need to make sure.

Thanks in advance.

-- John T.

Sure, ExecutionEngine::recompileAndRelinkFunction is your API.


But since that overwrites the beginning of the old version of the
function with a jump to the new version, be sure no threads are inside
there when you call it.