From c51e453849a68a940963b77e2be1b0ce227c547c Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Thu, 27 Feb 2025 08:17:09 +0100
Subject: [PATCH] perf experiment: remove noalias, readonly, dereferenceable
 attributes

---
 compiler/rustc_ty_utils/src/abi.rs | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 0ff82f0c256de..70fa3349ef089 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -392,13 +392,13 @@ fn adjust_for_rust_scalar<'tcx>(
             // potentially self-referential types (see
             // <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>). If LLVM had a way
             // to say "dereferenceable on entry" we could use it here.
-            attrs.pointee_size = match kind {
-                PointerKind::Box { .. }
-                | PointerKind::SharedRef { frozen: false }
-                | PointerKind::MutableRef { unpin: false } => Size::ZERO,
-                PointerKind::SharedRef { frozen: true }
-                | PointerKind::MutableRef { unpin: true } => pointee.size,
-            };
+            // attrs.pointee_size = match kind {
+            //     PointerKind::Box { .. }
+            //     | PointerKind::SharedRef { frozen: false }
+            //     | PointerKind::MutableRef { unpin: false } => Size::ZERO,
+            //     PointerKind::SharedRef { frozen: true }
+            //     | PointerKind::MutableRef { unpin: true } => pointee.size,
+            // };
 
             // The aliasing rules for `Box<T>` are still not decided, but currently we emit
             // `noalias` for it. This can be turned off using an unstable flag.
@@ -424,11 +424,11 @@ fn adjust_for_rust_scalar<'tcx>(
             // We can never add `noalias` in return position; that LLVM attribute has some very surprising semantics
             // (see <https://github.com/rust-lang/unsafe-code-guidelines/issues/385#issuecomment-1368055745>).
             if no_alias && !is_return {
-                attrs.set(ArgAttribute::NoAlias);
+                //attrs.set(ArgAttribute::NoAlias);
             }
 
             if matches!(kind, PointerKind::SharedRef { frozen: true }) && !is_return {
-                attrs.set(ArgAttribute::ReadOnly);
+                //attrs.set(ArgAttribute::ReadOnly);
             }
         }
     }