[LLVMdev] Issues with IPO optimization passes and JIT

Nick Lewycky nicholas at mxc.ca
Tue Jan 22 23:07:38 PST 2008


Were you running the Internalize pass? You should only do that on a 
finished program on which absolutely no new functions can possibly be added.

As an aside, if you remove Internalize you'll find that the other IPO 
functions do very little or nothing and should probably be removed.

Nick

Samit Basu wrote:
> Hello,
> 
> I am working on an LLVM-based JIT for a dynamically typed language
> (freemat.sf.net), and would like to commend the LLVM team on an
> awesome piece of work.  One issue I ran into that I was hoping for
> some clarification.  Nominally, I had started out by performing code
> generation from the AST into a function that was added to the current
> module.  I then ran a PassManager on that module to optimize the
> function -- this included several IPO passes (the entire list from -O3
> for opt, in fact).  I ran the optimizer after each function was
> generated.   I found that when I tried to execute functions via the
> JIT, I got unexpected and incorrect results -- for example, calling
> Invoke on a function would execute the wrong function.  The only
> solution was to replace the PassManager with a FunctionPassManager
> (following the example in the tutorial), and keep only basic block and
> function-level optimization steps.  Is this expected behavior?  Is it
> documented?  Should it be considered a bug?
> 
> Thanks in advance for any clarification.
> Samit
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 




More information about the llvm-dev mailing list