Skip to content

Commit a0cafe4

Browse files
committed
---
yaml --- r: 152041 b: refs/heads/try2 c: 22ab530 h: refs/heads/master i: 152039: 993354a v: v3
1 parent 120b239 commit a0cafe4

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0c51149ac97b818a31749d85bcb3b3f2332b94fb
8+
refs/heads/try2: 22ab5303ff03f09c1de24834a08e982e8b6e8fdd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)