Skip to content

Consider merging values and targets fields on MIR switchInt? #65693

Closed
@wesleywiser

Description

@wesleywiser

Writing some kinds of MIR passes that care about values and targets on switchInt can be a bit messy (for example, passes that remove dead branches). @oli-obk has the idea:

oli: I like it. The actual elimination is a bit convoluted, but I see no way around it. Maybe the values and targets fields of the SwitchInt variant could be merged into a single list, then one could use retain on the list

oli: the otherwise branch would then need a custom field, but that would be fine I think

oli: not sure how much other could would be affected by that (I think there's some code that just wants to know about all targets, but that could be helped by creating an accessor function returning an iterator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions