Skip to content

Faster compile times for release builds with small fix #44655

@andjo403

Description

@andjo403
Contributor

Was looking at the printout of llvm passes when I noticed that the functions that was inlined everywhere, and due to this was dead code, was optimized more after inlining.

So as a test I added MPM.add(createGlobalDCEPass()); at the line PassManagerBuilder.cpp#L480 and this reduces the compile time of release build in racer by an average of 23%.

I do not know if this is a good place to add this extra pass but maybe someone that knows how llvm works can use this information to speedup the compilation of release builds.

was also wondering how this works in MIR I see that there is an inline pass but I can not find any dead code elimination

Activity

added
I-compiletimeIssue: Problems and improvements with respect to compile times.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
on Sep 17, 2017
andjo403

andjo403 commented on Sep 17, 2017

@andjo403
ContributorAuthor

the stage1 compilation of rustc went from 828.89 to 691.75 secs with this fix on my computer but that is only a 15% improvement

oyvindln

oyvindln commented on Sep 17, 2017

@oyvindln
Contributor

15% is pretty significant.

jonas-schievink

jonas-schievink commented on Sep 17, 2017

@jonas-schievink
Contributor

Wow, great work!

added
C-enhancementCategory: An issue proposing an enhancement or a PR with one.
on Sep 17, 2017
TimNN

TimNN commented on Sep 17, 2017

@TimNN
Contributor

@andjo403: That's some nice improvements! If you feel up to it, go ahead an submit a pull request with your suggested changes. That way someone with experience with LLVM is guaranteed to look at the patch and it won't get lost.

leoyvens

leoyvens commented on Sep 17, 2017

@leoyvens
Contributor

I believe the PR should be targeted at https://github.com/rust-lang/llvm.

TimNN

TimNN commented on Sep 17, 2017

@TimNN
Contributor

@leodasvacas: 👍

@andjo403: If you want to push through this patch the general process works like this:

  • Submit the patch against the currently active branch of rust-lang/llvm (which is rust-llvm-release-4-0-1 at the moment)
  • Wait for it to get reviewed & merged
  • Submit a pull request against rust-lang/rust which updates the src/llvm submodule.

If you have any questions about the process or want someone else to do this, just mention it here or contact me or someone else on one of the Rust IRC channels.

Mark-Simulacrum

Mark-Simulacrum commented on Sep 17, 2017

@Mark-Simulacrum
Member
nagisa

nagisa commented on Sep 17, 2017

@nagisa
Member
cuviper

cuviper commented on Sep 17, 2017

@cuviper
Member

Ideally, the process should include discussion with upstream LLVM too.

andjo403

andjo403 commented on Sep 18, 2017

@andjo403
ContributorAuthor

7 remaining items

Loading
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-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @cuviper@alexcrichton@nagisa@andjo403@TimNN

      Issue actions

        Faster compile times for release builds with small fix · Issue #44655 · rust-lang/rust