Skip to content

Enums that don't carry anything in their arms shouldn't use shape glue #2916

Closed
@bblum

Description

@bblum
enum fast { x, y, z, w } 
enum slow<T> { a(T), b(T), c(T), d(T) }

fn foo(yy: fast, xx: fast) -> bool {
    ret yy == xx; 
}
fn bar(yy: slow<bool>, xx: slow<bool>) -> bool {
    ret yy == xx; 
}

Both foo and bar generate calls to upcall_cmp_type. It'd be nice if, for performance, the compiler could recognise that fast can be represented by a primitive and skip the upcalls.

Related to #2132.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions