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

Enable ThinLTO and incremental compilation #48996

Closed
alexcrichton opened this issue Mar 13, 2018 · 1 comment
Closed

Enable ThinLTO and incremental compilation #48996

alexcrichton opened this issue Mar 13, 2018 · 1 comment
Labels
A-incr-comp Area: Incremental compilation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

Currently ThinLTO is not compatible with incremental compilation, unfortunately. This is due to the fact that the codegen of an object file is actually dependent on all object files rather than just the one object file, which means we can rarely reuse anything!

ThinLTO, however, is explicitly designed with incrementality in mind. We're just not currently taking advantage of any of it! Last I remember checking in on this there's a good bit of nontrivial work that the incremental ThinLTO requires. Currently the ThinLTO support in rustc is largely a duplicate of that file (so far a duplicate of what we need) which helps us conform to our own requirements and integration better. This would likely best be implemented by tweaking the upstream interfaces to be more what we in rustc desire so we can directly use LLVM's support in this regard.

In any case, I realized we didn't have a tracking issue for this so I wanted to open one! At a high level I'd expect this to be tackled by:

  • Create a separate query/codepath in codegen which only emits bytecode, not object files (aka the optimization passes for one module)
  • When ThinLTO is enabled with incremental compilation we use this query instead of the previous "give me all the object files" query.
  • After all bytecode is loaded/optimized, we then transition to the ThinLTO-owned incremental phase. This'd probably reserve a special directory in the normal incremental directory for exclusive ownership by ThinLTO itself.
  • Once the ThinLTO passes have finished we've now got a bunch of object files so we can proceed as usual
@alexcrichton alexcrichton added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Mar 13, 2018
@XAMPPRocky XAMPPRocky added A-codegen Area: Code generation T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-incr-comp Area: Incremental compilation C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. and removed A-codegen Area: Code generation labels May 21, 2018
@alexcrichton
Copy link
Member Author

Implemented in #53673!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants