Skip to content

Enable ThinLTO and incremental compilation #48996

Closed

Description

@alexcrichton

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

Activity

  1. added
    A-LLVM
    on Mar 13, 2018
  2. added
    A-codegen
    T-compiler
    A-incr-comp
    C-tracking-issue
    and removed
    A-codegen
    on May 21, 2018
  3. alexcrichton commented on Dec 18, 2018

    @alexcrichton
    MemberAuthor

    Implemented in #53673!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMA-incr-compC-tracking-issueT-compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions