1
Fork 0

Move decision aboute noalias into codegen_llvm

The frontend shouldn't be deciding whether or not to use mutable
noalias attributes, as this is a pure LLVM concern. Only provide
the necessary information and do the actual decision in
codegen_llvm.
This commit is contained in:
Nikita Popov 2021-03-18 21:50:28 +01:00
parent f82664191d
commit dfc4cafe8e
4 changed files with 65 additions and 40 deletions

View file

@ -65,7 +65,10 @@ mod attr_impl {
const NoCapture = 1 << 2;
const NonNull = 1 << 3;
const ReadOnly = 1 << 4;
const InReg = 1 << 8;
const InReg = 1 << 5;
// NoAlias on &mut arguments can only be used with LLVM >= 12 due to miscompiles
// in earlier versions. FIXME: Remove this distinction once possible.
const NoAliasMutRef = 1 << 6;
}
}
}

View file

@ -1112,7 +1112,7 @@ pub enum PointerKind {
/// `&T` where `T` contains no `UnsafeCell`, is `noalias` and `readonly`.
Frozen,
/// `&mut T`, when we know `noalias` is safe for LLVM.
/// `&mut T` which is `noalias` but not `readonly`.
UniqueBorrowed,
/// `Box<T>`, unlike `UniqueBorrowed`, it also has `noalias` on returns.