[cfe-dev] Question on flags/ passes selection to improve code size

Robert Petrut Dumitru via cfe-dev cfe-dev at lists.llvm.org
Thu Dec 12 07:41:33 PST 2019


Hi,

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
in:

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,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191212/0b300c9f/attachment-0001.html>


More information about the cfe-dev mailing list