Skip to content

Stop using first class aggregates #20450

Closed
@dotdash

Description

@dotdash

For small structs/enums (size <= uint) we currently prefer to pass them as immediate values (good) but unlike clang we don't "cast" them to an appropriately sized integer type but pass them around as first class aggregates (not so good).

While LLVM supports the usage of FCAs, the optimizations largely depend on them being torn apart again, and that doesn't always work so great. The latest issue about that was #20149 for which I opted to patch LLVM to have it handle some basic store-to-load that involves FCA.

That led to the following email, in which Chandler Carruth suggests that we move away from using FCAs as much as possible: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141229/250758.html

AFAICT this would leave us with two choices:

  • Make all type that end up as structs or arrays in LLVM IR non-immediate

or

  • Do as clang does and convert small structs to an appropriately sized integer type when using them as SSA values

(Some) Related tickets are #20149 #16506 #13927
Cc @alexcrichton @thestinger @eddyb @erickt @Aatch @luqmana

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions