Auto merge of #137707 - RalfJung:aliasing-model-perf, r= · rust-lang/rust@8d95477 (original) (raw)

`@@ -392,13 +392,13 @@ fn adjust_for_rust_scalar<'tcx>(

`

392

392

`// potentially self-referential types (see

`

393

393

`// https://github.com/rust-lang/unsafe-code-guidelines/issues/381). If LLVM had a way

`

394

394

`// 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

`+

// };

`

402

402

``

403

403

`` // The aliasing rules for Box<T> are still not decided, but currently we emit

``

404

404

`` // noalias for it. This can be turned off using an unstable flag.

``

`@@ -424,11 +424,11 @@ fn adjust_for_rust_scalar<'tcx>(

`

424

424

`` // We can never add noalias in return position; that LLVM attribute has some very surprising semantics

``

425

425

`// (see https://github.com/rust-lang/unsafe-code-guidelines/issues/385#issuecomment-1368055745).

`

426

426

`if no_alias && !is_return {

`

427

``

`-

attrs.set(ArgAttribute::NoAlias);

`

``

427

`+

//attrs.set(ArgAttribute::NoAlias);

`

428

428

`}

`

429

429

``

430

430

`if matches!(kind, PointerKind::SharedRef { frozen: true }) && !is_return {

`

431

``

`-

attrs.set(ArgAttribute::ReadOnly);

`

``

431

`+

//attrs.set(ArgAttribute::ReadOnly);

`

432

432

`}

`

433

433

`}

`

434

434

`}

`