Skip to content

Commit

Permalink
auto merge of #6786 : thestinger/rust/revert-noalias-mut-rptr, r=niko…
Browse files Browse the repository at this point in the history
…matsakis

it can alias `&const` and `@mut`
  • Loading branch information
bors committed May 28, 2013
2 parents 05735a9 + accc527 commit 833ed21
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1694,16 +1694,13 @@ pub fn create_llargs_for_fn_args(cx: fn_ctxt,
let arg = &args[i];
let llarg = llvm::LLVMGetParam(cx.llfn, arg_n as c_uint);

// Mark `&mut T` as no-alias, as the borrowck pass ensures it's true
match arg.ty.node {
ast::ty_rptr(_, mt) => {
if mt.mutbl == ast::m_mutbl {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
}
}
// `~` pointers never alias other parameters, because ownership was transferred
ast::ty_uniq(_) => {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
}
// FIXME: #6785: `&mut` can only alias `&const` and `@mut`, we should check for
// those in the other parameters and then mark it as `noalias` if there aren't any
_ => {}
}

Expand Down

0 comments on commit 833ed21

Please sign in to comment.