[LLVMdev] llvm jit acting at runtime, like libgccjit ? (original) (raw)

Dibyendu Majumdar mobile at majumdar.org.uk
Thu Jul 9 08:27:47 PDT 2015


On 9 July 2015 at 15:53, James Molloy <james at jamesmolloy.co.uk> wrote:

You can do this by writing a trivial function with a loop in Clang and running:

clang -O0 -emit-llvm -S -o - my-trivial-program.c Clang, like any frontend, produces deliberately poor code and expects LLVM to clean it up - if you want more cleaned up code use -O2.

I find it is more useful to use this:

clang -cc1 -O1 -disable-llvm-optzns -S -emit-llvm prog.c

-O0 produces some extra rubbish that is just noise. -O1 and above can get rid of the code altogether - so using the disable optimizations flag appears to help.

Regards Dibyendu



More information about the llvm-dev mailing list