[llvm-dev] Optimizer takes very long

Ephrim Khong via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 10 06:55:46 PDT 2019

Dear All,

we are building a JIT compiler that uses LLVM as backend and are
running into issues with the compilation time. In the worst case,
compiling (i.e. optimizing and producing bytecode) a function with ~3k
lines takes up to 8-10 minutes. Note that we are not very concerned
with the actual performance of the JIT compiled code - anything binary
will be massively faster than what we have.

I am unsure how to proceed and what the issue might be. I found the
Performance Tips [1] and noticed that one of our building blocks has
almost 1000 predecessors, something that is disencouraged. Could that
be a problem? It's the result of a very long if-elseif-chain, where
all "else" branches branch to the first basic block after that
if-elseif chain.

Not adding any runs and setting OptLevel=0 already improves the
compilation time by a factor of 10 (from ~510 seconds to ~50 seconds).
Are there any other ways of debugging or inspecting what the cause
might be?

- Eph

[1] https://llvm.org/docs/Frontend/PerformanceTips.html

More information about the llvm-dev mailing list