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

Run base::internalize_symbols() even for single-codegen-unit crates. #34899

Merged
merged 1 commit into from
Jul 18, 2016

Conversation

michaelwoerister
Copy link
Member

The initial linkage-assignment (especially for closures) is a conservative one that makes some symbols more visible than they need to be. While this is not a correctness problem, it does force the LLVM inliner to be more conservative too, which results in poor performance. Once translation is based solely on MIR, it will be easier to also make the initial linkage assignment a better fitting one. Until then internalize_symbols() does a good job of preventing most performance regressions.

This should solve the regressions reported in #34891 and maybe also those in #34831.

As a side-effect, this will also solve most of the problematic cases described in #34793. Not reliably so, however. For that, we still need a solution like the one implement in #34830.

cc @rust-lang/compiler

The initial linkage-assignment (especially for closures) is a conservative one that makes some symbols more visible than they need to be. While this is not a correctness problem, it does force the LLVM inliner to be more conservative too, which results in poor performance. Once translation is based solely on MIR, it will be easier to also make the initial linkage assignment a better fitting one. Until then `internalize_symbols()` does a good job of preventing most performance regressions.
@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb
Copy link
Member

eddyb commented Jul 18, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Jul 18, 2016

📌 Commit 22f77a9 has been approved by eddyb

@TimNN
Copy link
Contributor

TimNN commented Jul 18, 2016

I benchmarked #34891 again with a local build of this pr and (as long as I haven't messed up) performance remains unchanged (that is, #34891 was not fixed by this pr as far as I can tell).

@eddyb
Copy link
Member

eddyb commented Jul 18, 2016

@michaelwoerister I would expect #34831 to be fixed by this, not necessarily #34891.

@michaelwoerister
Copy link
Member Author

@TimNN Interesting. I have benchmarked that use case and it seemed to be fixed for me. Maybe I have messed up somewhere? I'll give it another try tomorrow.

@eddyb Really? I would have thought the other way round.

@bors
Copy link
Contributor

bors commented Jul 18, 2016

⌛ Testing commit 22f77a9 with merge 9c88898...

bors added a commit that referenced this pull request Jul 18, 2016
…=eddyb

Run base::internalize_symbols() even for single-codegen-unit crates.

The initial linkage-assignment (especially for closures) is a conservative one that makes some symbols more visible than they need to be. While this is not a correctness problem, it does force the LLVM inliner to be more conservative too, which results in poor performance. Once translation is based solely on MIR, it will be easier to also make the initial linkage assignment a better fitting one. Until then `internalize_symbols()` does a good job of preventing most performance regressions.

This should solve the regressions reported in #34891 and maybe also those in #34831.

As a side-effect, this will also solve most of the problematic cases described in #34793. Not reliably so, however. For that, we still need a solution like the one implement in #34830.

cc @rust-lang/compiler
@bors bors merged commit 22f77a9 into rust-lang:master Jul 18, 2016
@michaelwoerister
Copy link
Member Author

@TimNN Interesting. I have benchmarked that use case and it seemed to be fixed for me. Maybe I have messed up somewhere? I'll give it another try tomorrow.

It seems it did mess up something with a last minute refactoring :/
There should be a == instead of a != here:

let is_definition = llvm::LLVMIsDeclaration(val) != 0;

bors added a commit that referenced this pull request Jul 22, 2016
Fix wrong condition in base::internalize_symbols().

Fix a typo that snuck into #34899 (and completely broke `internalize_symbols()`).
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

Successfully merging this pull request may close these issues.

6 participants