Skip to content

Teach LLVM about data ownership #21487

Closed
Closed
@Aatch

Description

@Aatch

Functions that take a non-immediate argument by-value are passed that value by-reference. If the argument needs to live in the current function's frame, we copy it to a local stack slot, but otherwise we'll just re-use the storage that is already there.

Unfortunately, LLVM does not understand that the caller cannot see any of the changes that we might make to the value, behind the passed reference. Since passing an argument by-value either a) copies, meaning that the caller already created a temporary slot, or b) moves, meaning that the slot from the caller is dead once the call returns, LLVM could optimise based on this information, we just need to inform it of that fact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationI-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions