Closed 18liumin closed 8 months ago
For inlining-for-size, you want to set up the build system to enable -Oz
or at least -Os
. This can be done in a variety of ways, for example CMake's CMAKE_BUILD_TYPE=MinSizeRel
. Just adding -Oz
or -Os
to the compiler flags may not work depending upon how the build system is setup. And then you just need -Xclang -fembed-bitcode=all
to embed the bitcode into the object file so that the ml-compiler-opt
tooling is able to process it.
Was there a comment/question here that got deleted? Got an email, but there's nothing here...
cmake -GNinja -DCMAKE_INSTALL_PREFIX:PATH=${PWD}/googletest_install -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_COMPILER=${LLVM_INSTALLDIR}/bin/clang++ -DCMAKE_C_COMPILER=${LLVM_INSTALLDIR}/bin/clang -DCMAKE_C_FLAGS="-Oz -Xclang -fembed-bitcode=all" -DCMAKE_CXX_FLAGS="-Oz -Xclang -fembed-bitcode=all" ..