[llvm-dev] Performance of JIT execution

Haoran Xu via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 3 19:00:51 PDT 2020


Hello,

I recently noticed a performance issue of JIT execution vs native code of
the following simple logic which computes the Fibonacci sequence:

uint64_t fib(int n) {
if (n <= 2) {
return 1;
} else {
return fib(n-1) + fib(n-2);
}
}

When compiled natively using clang++ with -O3, it took 0.17s to compute
fib(40). However, when executing using LLJIT, fed with the IR output of
"clang++ -emit-llvm -O3", it took 0.26s.

I don't know much about the internals of LLJIT, but my guess is since the
IR is the same, maybe LLJIT used a cheaper but lower quality instruction
selection pass, resulting in the slower runtime? Could someone working on
LLJIT clarify the difference in lowering passes between LLJIT and clang++?
And if I were to change this behavior, which APIs should I look at to begin
with?

Thanks for your time!

Best regards,
Haoran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200903/72bd5fb0/attachment.html>


More information about the llvm-dev mailing list