[LLVMdev] Module management questions

Owen Anderson resistor at me.com
Tue Aug 17 10:11:31 PDT 2010


On Aug 16, 2010, at 3:47 PM, Larry Gritz wrote:

> I have an app that's dynamically generating and JITing code, and will have many such cases in the course of its run.  They need to be JITed separately, because I need to execute the first batch before I know what the second one will be.  Of course, I *still* need to execute the first after the need for the second arises, so I need to retain the JITed machine code for all the functions I dynamically compile.
> 
> I think I just discovered the hard way that I can't keep adding to a single Module and ExecutionEngine, and re-optimizing -- certain combinations of optimization passes evidently are not happy doing this.  In particular, I seem to have special problems with templated (but not explicitly 'inline') C++ functions, when llvm inlining passes are used.  It seems to JIT fine, no errors, but I end up with my JITed code crashing upon execution (seg faults, and occasionally unknown opcodes).

In principle this ought to work, if you're careful.  Are you sure you're not generating code that calls into functions that got totally inlined away?  Are you running the Verifier pass at regular intervals?

--Owen




More information about the llvm-dev mailing list