Skip to content

Allow emitting more enums as SSA values #138373

Open
@scottmcm

Description

@scottmcm

In https://github.com/rust-lang/rust/pull/138157/files#diff-ec1143edac0931158bf79d598432eb162f53400086d30bfe1ba5266559831174R17 you can see that, because it's in a loop (I think [ed: wrongly, apparently]), the Option<u32> ends up getting spilled to an alloca despite it having ScalarPair ABI.

However it's only used in the same basic block, with the use after the initialization. Thus ideally we'd be able to just emit it as SSA values directly, rather than needing the read/write to the alloca.

(The full rule is probably a dominance check, but I don't know if the full one is worth doing, vs a simple approximation that catches common cases.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions