This is an archive of the discontinued LLVM Phabricator instance.

ELF: Add flag for controlling LTO optimization level.
ClosedPublic

Authored by pcc on Mar 31 2016, 12:48 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 52264.Mar 31 2016, 12:48 PM
pcc retitled this revision from to ELF: Add flag for controlling LTO optimization level..
pcc updated this object.
pcc added reviewers: rafael, ruiu.
pcc added a subscriber: llvm-commits.
ruiu added inline comments.Mar 31 2016, 12:59 PM
ELF/Config.h
93–94 ↗(On Diff #52264)

Sort.

LTOOptLevel -> LtoO because the members of Config are named after their corresponding command line options.

ELF/LTO.cpp
65 ↗(On Diff #52264)

Directly set Config->LtoOptLevel instead of passing it as a parameter.

ELF/Options.td
78 ↗(On Diff #52264)

I don't know if -lto-O is a good name. Does the gold LTO plugin have a simliar option? If so, what's the name of the option?

pcc updated this revision to Diff 52270.Mar 31 2016, 1:08 PM
pcc marked 2 inline comments as done.
  • Address review comments
ELF/Options.td
78 ↗(On Diff #52264)

It's -plugin-opt=O. I guess we don't want to use any plugin flags here.

ruiu edited edge metadata.Mar 31 2016, 1:11 PM

I think I slightly prefer -lto-opt over -lto-O, but I'd like to hear others opinions too.

Slightly off-topic: ld64 does not have this option, and we're not willing to add it. We have been discussing internally about how to communicate the "opt level" to the linker plugin, and we were thinking about some kind of metadata that would carry the configuration (including things like "fast-math" or other codegen related options).
I'm interested in your opinion :)

ruiu added a comment.Mar 31 2016, 1:16 PM

So the metadata would be carried on from the compiler to the linker? It feels a bit counter intuitive to me because actual LTO happens in the linker instead of the compiler. Also, if two metadata conflicts (for example, if one file has O3 and other is O1), what should we do?

ruiu accepted this revision.Mar 31 2016, 1:27 PM
ruiu edited edge metadata.

Looks like everybody's fine with this. LGTM.

This revision is now accepted and ready to land.Mar 31 2016, 1:27 PM
This revision was automatically updated to reflect the committed changes.