Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update LLVM comments around NoAliasMutRef
  • Loading branch information
cuviper committed Nov 5, 2021
1 parent aa35158 commit 767471e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions compiler/rustc_middle/src/ty/layout.rs
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_target/src/abi/call/mod.rs
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 767471e

Please sign in to comment.