提交 b738b576 编写于 作者: B bors

auto merge of #6754 : thestinger/rust/noalias, r=nikomatsakis

The compiler guarantees that there are no other references to a unique pointer when it's passed by-value to a function.

The existence of the header and annihilator don't matter since it's not relevant to the call:

> For a call to the parent function, dependencies between memory references from before or after the call and from those during the call are “irrelevant” to the noalias keyword for the arguments and return value used in that call.

@graydon's tracing garbage collector stores the metadata outside of the boxes, so that won't be a problem. I'm unsure if updating the header while inside a function where it's marked as `noalias` would be a problem anyway since you never actually read or write to the header.

@nikomatsakis: r?
......@@ -1701,6 +1701,9 @@ pub fn create_llargs_for_fn_args(cx: fn_ctxt,
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
}
}
ast::ty_uniq(_) => {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
}
_ => {}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册