mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-02 09:47:57 +00:00
Move `loop_hint_attrs` from `Terminator` into `TerminatorKind::Goto` Only the `Goto` variant uses `loop_hint_attrs`, so other variants shouldn't pay the cost. This shrinks `Terminator` and thus `BasicBlockData` by 8 bytes, and also simplifies many users of `Terminator`. Every byte saved from `BasicBlockData` makes a big difference in max-rss. For aws-sdk-ec2 full check, this saves 34.1 MiB (~0.62% of its peak RSS) Add a `TerminatorKind::goto` helper function for convenient construction with a target and no hints. With that helper available, most of this commit is simple, straightforward, mechanical translations of construction or pattern matching. The only notable changes are: - `compiler/rustc_codegen_ssa/src/mir/block.rs` actually uses the moved hints. - `compiler/rustc_middle/src/mir/mod.rs` updates the size assertions. - `compiler/rustc_mir_build/src/builder/cfg.rs` adds/updates helpers. - `compiler/rustc_mir_build/src/builder/expr/into.rs` has the one place that creates a `Goto` with non-empty hints. --- I have several more potential improvements to basic block sizes, but this one was an easy starting point.
Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.