Skip to content

atomic RMW intrinsics: avoid unnecessary ptr/int conversions #134617

Open
@RalfJung

Description

@RalfJung

Currently, the type of our atomic RMW intrinsics looks like

fn atomic_xadd_seqcst<T: Copy>(_dst: *mut T, _src: T) -> T

However, this is not quite what we want: for atomic operations on a pointer, we want dst to be something like *mut *mut T, but src should be usize. The return type should be *mut T.

This would let us avoid some unnecessary casts in AtomicPtr, and shift the burden of mapping this operation to something LLVM supports into the backend. It also makes the semantics of these operations more clear: only the provenance of the in-memory data matters; src carries no provenance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-atomicArea: Atomics, barriers, and sync primitivesA-codegenArea: Code generationA-intrinsicsArea: IntrinsicsA-strict-provenanceArea: Strict provenance for raw pointersC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing such

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions