Skip to content

AArch64 SelectionDAG issue with byval Arguments #62137

Open
@lenary

Description

@lenary

If you run llvm/test/CodeGen/Generic/2010-11-04-BigByval.ll through llc with the default target set to aarch64, you get an error when EXPENSIVE_CHECKS is enabled.

The issue comes down to the fact that the new stack-allocated copy will need to be made using memcpy, which ends up nesting two CALLSEQ_START/CALLSEQ_END regions, the one for the call with the byval arg, and the one for the memcpy (Prolog-Epilog insertion assumes they are not nested, because they represent how big the stack needs to be, and are turned into the stack pointer adjustments, so the stack pointer can be different within these sequences for the call) This issue has tried to be solved in the past (e.g. in https://reviews.llvm.org/D42006), but this was reverted because it caused SPEC failures.

How other backends (e.g. RISC-V) solve this is to do byval argument copying before the CALLSEQ_START, and leave emitting the pointer argument value to the call handling code within the call sequence.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions