[PATCH] D63976: Allow clang -Os and -Oz to work with -flto and lld
Teresa Johnson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 29 15:17:39 PDT 2019
tejohnson added inline comments.
================
Comment at: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp:395
+ if(OOpt == "s" || OOpt == "z")
+ OOpt = "3";
+ }
----------------
Os/Oz are closer to O2 than O3 (which allows much more aggressive code size increasing optimizations).
Better though to add a size level to the LTO::Config, teach lld to pass it through properly, then using the LTO Config to set the SizeLevel in the old PM and the PassBuilder::OptimizationLevel in the new PM when setting up the LTO backend pipelines, similar to how CodeGenLevel.OptimizeSize is handled in clang (BackendUtil.cpp).
My concern is that silently mapping Os/Oz to do something different than in the non-LTO pipeline is going to end up more confusing than the current error (which isn't good either, but at least makes it clear that it isn't supported).
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63976/new/
https://reviews.llvm.org/D63976
More information about the cfe-commits
mailing list