[LLVMdev] How do I use this to optimize C or C++ code?

Philipp Klaus Krause pkk at spth.de
Tue Nov 7 12:36:02 PST 2006


I tried
llvm-gcc -c test.c
llvm-gcc test.o
llc -march=c test.bc -f -o test2.c

Then I compiled both test.c and test2.c with sdcc, a compiler which
lacks high-level optimization. The code generated from test2.c was
bigger. Then I tried

llvm-gcc -O5 -Os -c test.c
llvm-gcc -O5 -Os test.o
llc -march=c test.bc -f -o test2.c

But it generated exactly the same code as the commands above.
What is it that I'm doing wrong? I expected llvm to optimize my code for
size, instead it gets worse.

Philipp



More information about the llvm-dev mailing list