Skip to content

Commit 8d95477

Browse files
committed
Auto merge of #137707 - RalfJung:aliasing-model-perf, r=<try>
perf experiment: remove noalias, readonly, dereferenceable attributes We sometimes get claims that these attributes aren't worth it, e.g. in a current discussion on the LKML. Let's see if we can get useful evidence just with the compiler test suite. I hope I got the diff right.^^ Cc `@Darksonn` `@ojeda` `@saethlin` `@nikic`
2 parents 96cfc75 + c51e453 commit 8d95477

File tree

1 file changed

+9
-9
lines changed
  • compiler/rustc_ty_utils/src

1 file changed

+9
-9
lines changed

compiler/rustc_ty_utils/src/abi.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ fn adjust_for_rust_scalar<'tcx>(
392392
// potentially self-referential types (see
393393
// <https://github.com/rust-lang/unsafe-code-guidelines/issues/381>). If LLVM had a way
394394
// to say "dereferenceable on entry" we could use it here.
395-
attrs.pointee_size = match kind {
396-
PointerKind::Box { .. }
397-
| PointerKind::SharedRef { frozen: false }
398-
| PointerKind::MutableRef { unpin: false } => Size::ZERO,
399-
PointerKind::SharedRef { frozen: true }
400-
| PointerKind::MutableRef { unpin: true } => pointee.size,
401-
};
395+
// attrs.pointee_size = match kind {
396+
// PointerKind::Box { .. }
397+
// | PointerKind::SharedRef { frozen: false }
398+
// | PointerKind::MutableRef { unpin: false } => Size::ZERO,
399+
// PointerKind::SharedRef { frozen: true }
400+
// | PointerKind::MutableRef { unpin: true } => pointee.size,
401+
// };
402402

403403
// The aliasing rules for `Box<T>` are still not decided, but currently we emit
404404
// `noalias` for it. This can be turned off using an unstable flag.
@@ -424,11 +424,11 @@ fn adjust_for_rust_scalar<'tcx>(
424424
// We can never add `noalias` in return position; that LLVM attribute has some very surprising semantics
425425
// (see <https://github.com/rust-lang/unsafe-code-guidelines/issues/385#issuecomment-1368055745>).
426426
if no_alias && !is_return {
427-
attrs.set(ArgAttribute::NoAlias);
427+
//attrs.set(ArgAttribute::NoAlias);
428428
}
429429

430430
if matches!(kind, PointerKind::SharedRef { frozen: true }) && !is_return {
431-
attrs.set(ArgAttribute::ReadOnly);
431+
//attrs.set(ArgAttribute::ReadOnly);
432432
}
433433
}
434434
}

0 commit comments

Comments
 (0)