Update LLVM comments around NoAliasMutRef

This commit is contained in:
Josh Stone 2021-11-05 12:22:51 -07:00
parent aa35158383
commit 767471edeb
2 changed files with 8 additions and 5 deletions

View File

@ -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,

View File

@ -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;
}
}