[llvm-dev] Question on flags/ passes selection to Improving code size for ARM cores

Robert Petrut Dumitru via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 11 07:26:35 PST 2019


I am looking at obtaining smaller code sizes for ARM cores. So far, I am
trying a  genetic algorithm to find the best option for the opt passes  and
clang/ llc flags.
I am looking at what flags and passes -Oz and the other optimization levels
enable and use. Having done something similar for gcc, I was looking for a
similar approach.
However, I was not able to find many optimization flags for clang or llc,
which made me think that in clang/llvm the optimization changes are done
mostly by selecting/removing the opt passes(flags).

In order to run what opt passes I select, I split the compilation process

clang  CLANG_FLAGS -emit-llvm  mysource1.c  -c -o mysource1.bc
opt  OPT_FLAGS  mysource1.bc -o mysource1.ll
llc LLC_FLAGS mysource1.ll -filetype=obj -o mysource1.o

I have also seen that for -Oz for example, the Pass Arguments appears
multiple time, does this mean that opt is run multiple times with different
passes options?

Now, my general direction questions are:

Am I on the right track with this?
Do you have any pointers or advice on this?

Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191211/f93ae7ed/attachment.html>

More information about the llvm-dev mailing list