Skip to content

Don't copy arguments passed by value with indirection to allocas. #12014

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

Merged
merged 1 commit into from
Feb 5, 2014

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Feb 3, 2014

No description provided.

@flaper87
Copy link
Contributor

flaper87 commented Feb 3, 2014

cc @nikomatsakis

@flaper87
Copy link
Contributor

flaper87 commented Feb 3, 2014

Could you please back this change up with the output of --emit-llvm and reference where it was introduced (if it was introduced recently) ?

@nikomatsakis
Copy link
Contributor

This change should be OK. I am wary of making trans less readable in the name of cleaner output, but this is a pretty minor diff.

if type_of::arg_is_indirect(bcx.ccx(), arg_ty) {
// Don't copy an indirect argument to an alloca, the caller
// already put it in a temporary alloca and gave it up.
bcx.fcx.schedule_drop_mem(arg_scope, arg.val, arg_ty);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it matters, but you could write: let arg_val = arg.add_clean(arg_scope); and then use arg_val below. That's how the datum class is intended to be used (i.e., more like a linear value -- it should always get consumed)

@nikomatsakis
Copy link
Contributor

(r+ with that nit corrected)

bors added a commit that referenced this pull request Feb 5, 2014
@bors bors closed this Feb 5, 2014
@bors bors merged commit 01815b3 into rust-lang:master Feb 5, 2014
@eddyb eddyb deleted the less-copies branch February 5, 2014 06:07
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
feat: Attempt to format expand_macro output with rustfmt if possible

Fixes rust-lang/rust-analyzer#10548
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.

5 participants