Skip to content

Commit 767471e

Browse files
committed
Update LLVM comments around NoAliasMutRef
1 parent aa35158 commit 767471e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

compiler/rustc_middle/src/ty/layout.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3060,9 +3060,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
30603060
// LLVM's definition of `noalias` is based solely on memory
30613061
// dependencies rather than pointer equality
30623062
//
3063-
// Due to miscompiles in LLVM < 12, we apply a separate NoAliasMutRef attribute
3064-
// for UniqueBorrowed arguments, so that the codegen backend can decide
3065-
// whether or not to actually emit the attribute.
3063+
// Due to past miscompiles in LLVM, we apply a separate NoAliasMutRef attribute
3064+
// for UniqueBorrowed arguments, so that the codegen backend can decide whether
3065+
// or not to actually emit the attribute. It can also be controlled with the
3066+
// `-Zmutable-noalias` debugging option.
30663067
let no_alias = match kind {
30673068
PointerKind::Shared | PointerKind::UniqueBorrowed => false,
30683069
PointerKind::UniqueOwned => true,

compiler/rustc_target/src/abi/call/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ mod attr_impl {
6868
const NonNull = 1 << 3;
6969
const ReadOnly = 1 << 4;
7070
const InReg = 1 << 5;
71-
// NoAlias on &mut arguments can only be used with LLVM >= 12 due to miscompiles
72-
// in earlier versions. FIXME: Remove this distinction once possible.
71+
// Due to past miscompiles in LLVM, we use a separate attribute for
72+
// &mut arguments, so that the codegen backend can decide whether
73+
// or not to actually emit the attribute. It can also be controlled
74+
// with the `-Zmutable-noalias` debugging option.
7375
const NoAliasMutRef = 1 << 6;
7476
}
7577
}

0 commit comments

Comments
 (0)