diff options
| author | Josh Stone <jistone@redhat.com> | 2021-11-05 12:22:51 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2021-11-05 12:22:51 -0700 |
| commit | 767471edebd292d7b6386ed236e82abef9abc330 (patch) | |
| tree | ab8d7be284320bf0bc859c34d40548f13e177c53 | |
| parent | aa35158383d5e409a13be1a0e87b33c549855a1f (diff) | |
| download | rust-767471edebd292d7b6386ed236e82abef9abc330.tar.gz rust-767471edebd292d7b6386ed236e82abef9abc330.zip | |
Update LLVM comments around NoAliasMutRef
| -rw-r--r-- | compiler/rustc_middle/src/ty/layout.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_target/src/abi/call/mod.rs | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 8ec5f4c7978..b87e23af72b 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -3060,9 +3060,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { // LLVM's definition of `noalias` is based solely on memory // dependencies rather than pointer equality // - // Due to miscompiles in LLVM < 12, we apply a separate NoAliasMutRef attribute - // for UniqueBorrowed arguments, so that the codegen backend can decide - // whether or not to actually emit the attribute. + // Due to past miscompiles in LLVM, we apply a separate NoAliasMutRef attribute + // for UniqueBorrowed arguments, so that the codegen backend can decide whether + // or not to actually emit the attribute. It can also be controlled with the + // `-Zmutable-noalias` debugging option. let no_alias = match kind { PointerKind::Shared | PointerKind::UniqueBorrowed => false, PointerKind::UniqueOwned => true, diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index d9eb299e2fd..4768c9e2db5 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -68,8 +68,10 @@ mod attr_impl { const NonNull = 1 << 3; const ReadOnly = 1 << 4; 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. + // Due to past miscompiles in LLVM, we use a separate attribute for + // &mut arguments, so that the codegen backend can decide whether + // or not to actually emit the attribute. It can also be controlled + // with the `-Zmutable-noalias` debugging option. const NoAliasMutRef = 1 << 6; } } |
