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

Avoid unnecessary scratch datums for by-copy function arguments #7237

Closed
wants to merge 1 commit into from

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Jun 19, 2013

Currently, by-copy function arguments are always stored into a scratch
datum, which serves two purposes. First, it is required to be able to
have a temporary cleanup, in case that the call fails before the callee
actually takes ownership of the value. Second, if the argument is to be
passed by reference, the copy is required, so that the function doesn't
get a reference to the original value.

But in case that the datum does not need a drop glue call and it is
passed by value, there's no need to perform the extra copy.

Reduces the time for the LLVM passes when compiling librustc by about
10%.

Currently, by-copy function arguments are always stored into a scratch
datum, which serves two purposes.  First, it is required to be able to
have a temporary cleanup, in case that the call fails before the callee
actually takes ownership of the value. Second, if the argument is to be
passed by reference, the copy is required, so that the function doesn't
get a reference to the original value.

But in case that the datum does not need a drop glue call and it is
passed by value, there's no need to perform the extra copy.

Reduces the time for the LLVM passes when compiling librustc by about
10%.
@dotdash
Copy link
Contributor Author

dotdash commented Jun 20, 2013

I somehow messed up the time measurement. Since this is now contained in #7259 I'll close this one.

@dotdash dotdash closed this Jun 20, 2013
flip1995 added a commit to flip1995/rust that referenced this pull request May 20, 2021
…ip1995

Add the command to add upstream remote

changelog: none

Adding this command should better help new contributors.
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 20, 2021
Rollup of 3 pull requests

Successful merges:

 - rust-lang#7235 (Fix another manual_unwrap_or deref FP)
 - rust-lang#7237 (Add the command to add upstream remote)
 - rust-lang#7239 (CI: update rustup before installing the toolchain on windows)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

changelog: rollup
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.

2 participants