Skip to content

Commit f097cca

Browse files
committed
---
yaml --- r: 117974 b: refs/heads/try c: 22ab530 h: refs/heads/master v: v3
1 parent 0fbb232 commit f097cca

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3770c42a4959cbabc73da52abc7e3db96657974e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: 0c51149ac97b818a31749d85bcb3b3f2332b94fb
5+
refs/heads/try: 22ab5303ff03f09c1de24834a08e982e8b6e8fdd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,16 +1728,20 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
17281728

17291729
for (idx, &t) in fn_sig.inputs.iter().enumerate().map(|(i, v)| (i + first_arg_offset, v)) {
17301730
match ty::get(t).sty {
1731+
// this needs to be first to prevent fat pointers from falling through
1732+
_ if !type_is_immediate(ccx, t) => {
1733+
// For non-immediate arguments the callee gets its own copy of
1734+
// the value on the stack, so there are no aliases. It's also
1735+
// program-invisible so can't possibly capture
1736+
attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
1737+
attrs.push((idx, lib::llvm::NoCaptureAttribute as u64));
1738+
attrs.push((idx, lib::llvm::NonNullAttribute as u64));
1739+
}
17311740
// `~` pointer parameters never alias because ownership is transferred
17321741
ty::ty_uniq(_) => {
17331742
attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
17341743
attrs.push((idx, lib::llvm::NonNullAttribute as u64));
17351744
}
1736-
// These are not really pointers but pairs, (pointer, len)
1737-
ty::ty_rptr(_, ty::mt { ty: it, .. }) |
1738-
ty::ty_rptr(_, ty::mt { ty: it, .. }) if match ty::get(it).sty {
1739-
ty::ty_str | ty::ty_vec(..) => true, _ => false
1740-
} => {}
17411745
// `&mut` pointer parameters never alias other parameters, or mutable global data
17421746
ty::ty_rptr(b, mt) if mt.mutbl == ast::MutMutable => {
17431747
attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
@@ -1759,16 +1763,7 @@ pub fn get_fn_llvm_attributes(ccx: &CrateContext, fn_ty: ty::t) -> Vec<(uint, u6
17591763
ty::ty_rptr(_, _) => {
17601764
attrs.push((idx, lib::llvm::NonNullAttribute as u64));
17611765
}
1762-
_ => {
1763-
// For non-immediate arguments the callee gets its own copy of
1764-
// the value on the stack, so there are no aliases. It's also
1765-
// program-invisible so can't possibly capture
1766-
if !type_is_immediate(ccx, t) {
1767-
attrs.push((idx, lib::llvm::NoAliasAttribute as u64));
1768-
attrs.push((idx, lib::llvm::NoCaptureAttribute as u64));
1769-
attrs.push((idx, lib::llvm::NonNullAttribute as u64));
1770-
}
1771-
}
1766+
_ => ()
17721767
}
17731768
}
17741769

0 commit comments

Comments
 (0)