Skip to content

Commit 92752e9

Browse files
committed
Auto merge of #86036 - nikic:disable-mutable-noalias, r=Mark-Simulacrum
[beta] Disable mutable noalias for Rust 1.53 Disable mutable noalias for the upcoming release to give this change more time to bake. I believe that was the consensus, and I wanted to make sure we don't forget :) r? `@Mark-Simulacrum`
2 parents d86f9d4 + bbd370c commit 92752e9

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

compiler/rustc_codegen_llvm/src/abi.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::builder::Builder;
22
use crate::context::CodegenCx;
33
use crate::llvm::{self, AttributePlace};
4-
use crate::llvm_util;
54
use crate::type_::Type;
65
use crate::type_of::LayoutLlvmExt;
76
use crate::value::Value;
@@ -52,15 +51,9 @@ pub trait ArgAttributesExt {
5251
}
5352

5453
fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
55-
// LLVM prior to version 12 has known miscompiles in the presence of
56-
// noalias attributes (see #54878). Only enable mutable noalias by
57-
// default for versions we believe to be safe.
58-
cx.tcx
59-
.sess
60-
.opts
61-
.debugging_opts
62-
.mutable_noalias
63-
.unwrap_or_else(|| llvm_util::get_version() >= (12, 0, 0))
54+
// While #84958 has been fixed, mutable noalias is not enabled by default
55+
// in Rust 1.53 out of an abundance of caution.
56+
cx.tcx.sess.opts.debugging_opts.mutable_noalias.unwrap_or(false)
6457
}
6558

6659
impl ArgAttributesExt for ArgAttributes {

src/test/codegen/function-arguments.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ pub fn named_borrow<'r>(_: &'r i32) {
4343
pub fn unsafe_borrow(_: &UnsafeInner) {
4444
}
4545

46-
// CHECK: @mutable_unsafe_borrow(i16* noalias align 2 dereferenceable(2) %_1)
46+
// CHECK: @mutable_unsafe_borrow(i16* align 2 dereferenceable(2) %_1)
4747
// ... unless this is a mutable borrow, those never alias
4848
#[no_mangle]
4949
pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {
5050
}
5151

52-
// CHECK: @mutable_borrow(i32* noalias align 4 dereferenceable(4) %_1)
52+
// CHECK: @mutable_borrow(i32* align 4 dereferenceable(4) %_1)
5353
// FIXME #25759 This should also have `nocapture`
5454
#[no_mangle]
5555
pub fn mutable_borrow(_: &mut i32) {
@@ -94,7 +94,7 @@ pub fn helper(_: usize) {
9494
pub fn slice(_: &[u8]) {
9595
}
9696

97-
// CHECK: @mutable_slice([0 x i8]* noalias nonnull align 1 %_1.0, [[USIZE]] %_1.1)
97+
// CHECK: @mutable_slice([0 x i8]* nonnull align 1 %_1.0, [[USIZE]] %_1.1)
9898
// FIXME #25759 This should also have `nocapture`
9999
#[no_mangle]
100100
pub fn mutable_slice(_: &mut [u8]) {

0 commit comments

Comments
 (0)