Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -O4 flag for link-time optimization #15818

Closed
alexchandel opened this issue Jul 20, 2014 · 7 comments
Closed

Add -O4 flag for link-time optimization #15818

alexchandel opened this issue Jul 20, 2014 · 7 comments

Comments

@alexchandel
Copy link

Currently we have -Z lto which will "Perform LLVM link-time optimizations". Clang has the -O4 flag for that purpose, which is convenient and makes sense.

@thestinger
Copy link
Contributor

The -O4 flag in clang no longer enables link-time optimization, it's the same as -O3.

@alexchandel
Copy link
Author

I still like it...

@huonw
Copy link
Member

huonw commented Jul 20, 2014

The -Z flags represent experimental/"internals" features. LTO is something that is still a work-in-progress with many bugs etc, and so it is under -Z for this reason.

@errordeveloper
Copy link
Contributor

This flag would be very misleading and limited, it would have to imply one of the optimisations levels and LTO, e.g. optimisation level 3 and LTO. What if I want to optimise for size and still do LTO?

I am voting to close this 👎

@alexchandel
Copy link
Author

@errordeveloper
I don't think rustc supports size optimization currently (except perhaps through --llvm-args="..."). Combining flags isn't necessarily limiting. For example, gcc's -Os option implies -O2 plus the size-for-speed tradeoff optimizations.

And it hopefully won't be -Z lto forever. I admit link time optimizations are somewhat orthogonal to earlier optimizations. What about an additional argument to opt-level like --opt-level 3l, or --lto?

@thestinger
Copy link
Contributor

I think -C lto would make the most sense, and it could just be moved there now.

@alexchandel: -Os in clang is different than just optsize on every function, it runs slightly different passes and uses a lower inline threshold

@thestinger
Copy link
Contributor

Closing in favour of #12443.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants