Skip to content

rustc wantonly inlines drop glue with -O  #18864

Closed
@comex

Description

@comex

When investigating the cause of large binary sizes, even with -O, I found that at least one of my functions, do_insn, is about 64K all by itself, despite being not all that complicated (even after inlining): decompiling the binary code with Hex-Rays shows that the vast majority of it is extremely repetitive drop glue, which seems like it's being inappropriately inlined. This does not happen without -O.

Frankly... this is a mess. When I tried to reduce the code in even small ways, the blowup stopped happening: making i_phi #[inline(never)] reduces the total size of the binary by some 60K, while changing the implementation of get to unimplemented!() drastically reduces the size of do_insn even if it's marked inline(never). Faced with this, I'm not really sure what to do other than post the random WIP crappy code I'm working on and hope that a general issue can be identified without looking too closely. I know this is the worst possible thing to receive as a bug report, but for now that's the best I can do.

Is there any way to inline(never) drop glue? If not, it would be nice to have.

https://gist.github.com/comex/24abeab6b99680b045ca contains the Hex-Rays output, the source code (although it will not build without other files), and the LLVM IR produced with -O.

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