diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-18 21:50:28 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-21 20:10:53 +0100 |
| commit | dfc4cafe8e7b5c5198ba3a9d9c57a2e1f09d03bd (patch) | |
| tree | 046a10c5a9fdce4babdfa73e18f9ce442e138c51 /compiler/rustc_target/src | |
| parent | f82664191d0e8764b7435b9d72eb0e366b8b1464 (diff) | |
| download | rust-dfc4cafe8e7b5c5198ba3a9d9c57a2e1f09d03bd.tar.gz rust-dfc4cafe8e7b5c5198ba3a9d9c57a2e1f09d03bd.zip | |
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.
Diffstat (limited to 'compiler/rustc_target/src')
| -rw-r--r-- | compiler/rustc_target/src/abi/call/mod.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_target/src/abi/mod.rs | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 0deb1186b0f..2c3f7762759 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -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; } } } diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index b14b1ef00db..e2618da749f 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -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. |
