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

Improve IR codegen #7259

Merged
merged 2 commits into from
Jun 21, 2013
Merged

Improve IR codegen #7259

merged 2 commits into from
Jun 21, 2013

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Jun 20, 2013

The changes in these commits improve the IR codegen by removing unnecessary copies for certain function call arguments and stopping to allocate return values for functions returning nil. They reduce compile times by about 10% in total.

@emberian
Copy link
Member

benchmark

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.
By using "void" instead of "{}" as the LLVM type for nil, we can avoid
the alloca/store/load sequence for the return value, resulting in less
and simpler IR code.

This reduces compile times by about 10%.
bors added a commit that referenced this pull request Jun 21, 2013
The changes in these commits improve the IR codegen by removing unnecessary copies for certain function call arguments and stopping to allocate return values for functions returning nil. They reduce compile times by about 10% in total.
@bors bors closed this Jun 21, 2013
@bors bors merged commit 4fb2c09 into rust-lang:master Jun 21, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 3, 2021
…_trait, r=llogiq

Fix invalid syntax in `from_iter_instead_of_collect` suggestion

First attempt at contributing, hopefully this is a good start and can be improved. :)

fixes rust-lang#7259

changelog: [`from_iter_instead_of_collect`] fix invalid suggestion involving "as Trait"
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.

4 participants