Skip to content

When we switch to opaque pointers, stop identifying ADTs in LLVM IR (with fewer_names) #96242

Closed
@erikdesjardins

Description

@erikdesjardins

This is an extension of #94107. It may be a minor perf win.

Basically, when we switch to using opaque pointers, this comment will no longer be true:

// Use identified structure types for ADT. Due to pointee types in LLVM IR their definition
// might be recursive. Other cases are non-recursive and we can use literal structure types.
ty::Adt(..) => Some(String::new()),

@rustbot label A-llvm T-compiler S-blocked


Edit: the simplest implementation, e.g. changing those lines to

        // In LLVM < 15, use identified structure types for ADT. Due to pointee types in LLVM IR their definition
        // might be recursive. Other cases are non-recursive and we can use literal structure types.
        // In LLVM 15, we use opaque pointers, so there are no pointee types and no potential recursion.
        ty::Adt(..) if get_version() < (15, 0, 0) => Some(String::new()),

doesn't work because then we end up infinitely recursing into the pointee type in order to generate a literal struct type. (Removing pointee types from the codegen backend would avoid this, which I am working on.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.S-blockedStatus: Blocked on something else such as an RFC or other implementation work.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