-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Elide unnecessary ret slot allocas #8270
Conversation
Did this have an effect on compile time? |
I only measured on a branch together with a few other WIP changes, and all those together amounted to about 2-3s off of a librustc build with llvm assertion disabled. Going from about 1m36 to 1m33s. |
Someone else more familiar with trans should review this as well. @pcwalton? |
A comment I left in IRC: "The thing that most concerns me is that it incidentally adds two high-level bindings for LLVM types, and I'm not sure whether that jives with whatever intentions we have here." |
@dotdash also needs a rebase |
Performed some measurements after rebasing. LLVM passes actually get a bit slower (about 1%), but the resulting code is better. For example, LLVM inlines closures more often. The benchmark from issue #6623 shows this: Before with -O:
After with -O:
Before without -O:
After without -O:
|
FWIW the newtype wrappers were loosely modelled after the existing |
@dotdash can you include the benchmarks in the PR? that's the only thing stopping me from giving this an r+ |
When there is only a single store to the ret slot that dominates the load that gets the value for the "ret" instruction, we can elide the ret slot and directly return the operand of the dominating store instruction. This is the same thing that clang does, except for a special case that doesn't seem to affect us. Fixes rust-lang#8238
Added a codegen test, that was easy enough ;-) |
When there is only a single store to the ret slot that dominates the load that gets the value for the "ret" instruction, we can elide the ret slot and directly return the operand of the dominating store instruction. This is the same thing that clang does, except for a special case that doesn't seem to affect us. Fixes #8238
When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.
Fixes #8238