Skip to content

Convert trivial copy constructor and assignment operator calls to memcpy #1202

Open
@smeenai

Description

@smeenai

CodeGen replaces trivial copy constructors and assignment operators with memcpy. ClangIR intentionally doesn't do so when generating CIR, so that all those function calls are available for analysis: https://godbolt.org/z/xcKdzKaWM. We'd ideally switch to the memcpy at some point before generating LLVM though, to generate better code. One potentially idea would be to tag either the functions themselves or the call sites during CIR generation, and then have a later pass (e.g. LoweringPrepare) do the memcpy conversion. Search for isMemcpyEquivalentSpecialMember under clang/lib/CodeGen for examples of how it handles this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersoptimizationOptimizations that can be implemented at the ClangIR level

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions