[LLVMdev] is this code really JITed and/or optimized ? ..

Reid Spencer reid at x10sys.com
Fri Aug 13 15:29:45 PDT 2004


Valery,

The line in the file HowToUseJIT.cpp that reads:
   ExecutionEngine* EE = ExecutionEngine::create( MP, true );

should be
   ExecutionEngine* EE = ExecutionEngine::create( MP, false);

The second parameter is "forceInterpreter" which will always cause 
interpretation.  I left it that way because that's what you had in your 
original submission. Thought you wanted to compare them.

Anyway, the above change will allow JIT to happen.

Reid.

Chris Lattner wrote:

> On Sat, 14 Aug 2004, Valery A.Khamenya wrote:
> 
> 
>>(thanks to Reid, who gave nice advice) the fibonacci function code
>>works now. Please find attached file.
>>
>>but... the performance is adequate, say, for byte-code
>>interpretation mode and not for optimized JITing.
>>fibonacci function of 35 from attached file is more
>>then 100 times slower then the following code compiled
>>with "gcc -O2" :
>>-----------
>>#include <iostream>
>>int fib(int x) {
>>if(x<=2) return 1;
>>return fib(x-1)+fib(x-2);
>>}
>>
>>int main(int argc, char**argv) {
>>  int n = argc > 1 ? atol(argv[1]) : 10;
>>  std::cout << fib(n) << "\n";
>>}
>>-----------
>>
>>Where's the rake I step at?..
>>
>>I guess the JIT was not really invoked or code was not optimized..
> 
> 
> If it's that slow, you're probably getting the interpreter instead of the
> JIT.  Try adding -print-machineinstr to the command line, or -debug, and
> see what happens.  If you're not getting the JIT, try stepping through the
> LLVM program to see where it makes the execution engine and decides which
> one to use...
> 
> -Chris
> 




More information about the llvm-dev mailing list