The changes are to support Os and Oz inside the LTO.
Thanks for the patch.
I think this probably should be split up in 2 different changes:
- Changes to the pipeline (llvm/lib/Transforms/IPO/PassManagerBuilder.cpp). Ideally those come with some data motivating the change and why there won't be regressions.
- Changes to LTOCodeGenerator & co. They also need a test.