diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 640f31355ac33..71d1829f76584 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -852,7 +852,6 @@ fn test_unstable_options_tracking_hash() { tracked!(mir_opt_level, Some(4)); tracked!(mir_preserve_ub, true); tracked!(move_size_limit, Some(4096)); - tracked!(mutable_noalias, false); tracked!(next_solver, NextSolverConfig { coherence: true, globally: true }); tracked!(no_generate_arange_section, true); tracked!(no_link, true); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 2f44b4c102486..d508c963791d4 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2568,8 +2568,6 @@ options! { "Whether to remove some of the MIR debug info from methods. Default: None"), move_size_limit: Option = (None, parse_opt_number, [TRACKED], "the size at which the `large_assignments` lint starts to be emitted"), - mutable_noalias: bool = (true, parse_bool, [TRACKED], - "emit noalias metadata for mutable references (default: yes)"), namespaced_crates: bool = (false, parse_bool, [TRACKED], "allow crates to be namespaced by other crates (default: no)"), next_solver: NextSolverConfig = (NextSolverConfig::default(), parse_next_solver_config, [TRACKED], diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index 8873fb13efe03..1cc128c9b46eb 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -366,11 +366,6 @@ fn arg_attrs_for_rust_scalar<'tcx>( // See https://github.com/rust-lang/unsafe-code-guidelines/issues/326 let noalias_for_box = tcx.sess.opts.unstable_opts.box_noalias; - // LLVM prior to version 12 had known miscompiles in the presence of noalias attributes - // (see #54878), so it was conditionally disabled, but we don't support earlier - // versions at all anymore. We still support turning it off using -Zmutable-noalias. - let noalias_mut_ref = tcx.sess.opts.unstable_opts.mutable_noalias; - // `&T` where `T` contains no `UnsafeCell` is immutable, and can be marked as both // `readonly` and `noalias`, as LLVM's definition of `noalias` is based solely on memory // dependencies rather than pointer equality. However this only applies to arguments, @@ -379,7 +374,7 @@ fn arg_attrs_for_rust_scalar<'tcx>( // `&mut T` and `Box` where `T: Unpin` are unique and hence `noalias`. let no_alias = match kind { PointerKind::SharedRef { frozen } => frozen, - PointerKind::MutableRef { unpin } => unpin && noalias_mut_ref, + PointerKind::MutableRef { unpin } => unpin, PointerKind::Box { unpin, global } => unpin && global && noalias_for_box, }; // We can never add `noalias` in return position; that LLVM attribute has some very surprising semantics diff --git a/tests/codegen-llvm/noalias-flag.rs b/tests/codegen-llvm/noalias-flag.rs deleted file mode 100644 index 67ba68ee6f80a..0000000000000 --- a/tests/codegen-llvm/noalias-flag.rs +++ /dev/null @@ -1,23 +0,0 @@ -//@ compile-flags: -Copt-level=3 -Zmutable-noalias=no - -#![crate_type = "lib"] - -// `-Zmutable-noalias=no` should disable noalias on mut refs... - -// CHECK-LABEL: @test_mut_ref( -// CHECK-NOT: noalias -// CHECK-SAME: %x -#[no_mangle] -pub fn test_mut_ref(x: &mut i32) -> &mut i32 { - x -} - -// ...but not on shared refs - -// CHECK-LABEL: @test_ref( -// CHECK-SAME: noalias -// CHECK-SAME: %x -#[no_mangle] -pub fn test_ref(x: &i32) -> &i32 { - x -} diff --git a/tests/codegen-llvm/noalias-refcell.rs b/tests/codegen-llvm/noalias-refcell.rs index b37adf92b9cc3..87f3ea624700a 100644 --- a/tests/codegen-llvm/noalias-refcell.rs +++ b/tests/codegen-llvm/noalias-refcell.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen-llvm/noalias-rwlockreadguard.rs b/tests/codegen-llvm/noalias-rwlockreadguard.rs index c676dc32399da..7eacf6c792eb8 100644 --- a/tests/codegen-llvm/noalias-rwlockreadguard.rs +++ b/tests/codegen-llvm/noalias-rwlockreadguard.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/tests/codegen-llvm/noalias-unpin.rs b/tests/codegen-llvm/noalias-unpin.rs index 30a8b399b9798..b164495e50724 100644 --- a/tests/codegen-llvm/noalias-unpin.rs +++ b/tests/codegen-llvm/noalias-unpin.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Copt-level=3 -Z mutable-noalias=yes +//@ compile-flags: -Copt-level=3 #![crate_type = "lib"]