diff options
| author | bors <bors@rust-lang.org> | 2024-06-24 19:22:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-24 19:22:01 +0000 |
| commit | d8d5732456d375f7c4bdc2f6ad771989a5e0ae02 (patch) | |
| tree | b6f0fb34824c6fd06d3a316015884ef8e2e0fa30 /compiler/rustc_middle/src/mir | |
| parent | 5a3e2a4e921097c8f2bf6ea7565f8abe878cdbd4 (diff) | |
| parent | b28efb11af6c3aea1117df81df9fc6ddf5b88077 (diff) | |
| download | rust-d8d5732456d375f7c4bdc2f6ad771989a5e0ae02.tar.gz rust-d8d5732456d375f7c4bdc2f6ad771989a5e0ae02.zip | |
Auto merge of #126784 - scottmcm:smaller-terminator, r=compiler-errors
Save 2 pointers in `TerminatorKind` (96 → 80 bytes) These things don't need to be `Vec`s; boxed slices are enough. The frequent one here is call arguments, but MIR building knows the number of arguments from the THIR, so the collect is always getting the allocation right in the first place, and thus this shouldn't ever add the shrink-in-place overhead.
Diffstat (limited to 'compiler/rustc_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/syntax.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 01cefc75194..ef88b253864 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1817,11 +1817,11 @@ mod size_asserts { use super::*; use rustc_data_structures::static_assert_size; // tidy-alphabetical-start - static_assert_size!(BasicBlockData<'_>, 144); + static_assert_size!(BasicBlockData<'_>, 128); static_assert_size!(LocalDecl<'_>, 40); static_assert_size!(SourceScopeData<'_>, 64); static_assert_size!(Statement<'_>, 32); - static_assert_size!(Terminator<'_>, 112); + static_assert_size!(Terminator<'_>, 96); static_assert_size!(VarDebugInfo<'_>, 88); // tidy-alphabetical-end } diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 0fc84ea5c62..2c2884f1897 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -730,7 +730,7 @@ pub enum TerminatorKind<'tcx> { /// reused across function calls without duplicating the contents. /// The span for each arg is also included /// (e.g. `a` and `b` in `x.foo(a, b)`). - args: Vec<Spanned<Operand<'tcx>>>, + args: Box<[Spanned<Operand<'tcx>>]>, /// Where the returned value will be written destination: Place<'tcx>, /// Where to go after this call returns. If none, the call necessarily diverges. @@ -837,7 +837,7 @@ pub enum TerminatorKind<'tcx> { template: &'tcx [InlineAsmTemplatePiece], /// The operands for the inline assembly, as `Operand`s or `Place`s. - operands: Vec<InlineAsmOperand<'tcx>>, + operands: Box<[InlineAsmOperand<'tcx>]>, /// Miscellaneous options for the inline assembly. options: InlineAsmOptions, @@ -849,7 +849,7 @@ pub enum TerminatorKind<'tcx> { /// Valid targets for the inline assembly. /// The first element is the fallthrough destination, unless /// InlineAsmOptions::NORETURN is set. - targets: Vec<BasicBlock>, + targets: Box<[BasicBlock]>, /// Action to be taken if the inline assembly unwinds. This is present /// if and only if InlineAsmOptions::MAY_UNWIND is set. @@ -1561,6 +1561,6 @@ mod size_asserts { static_assert_size!(PlaceElem<'_>, 24); static_assert_size!(Rvalue<'_>, 40); static_assert_size!(StatementKind<'_>, 16); - static_assert_size!(TerminatorKind<'_>, 96); + static_assert_size!(TerminatorKind<'_>, 80); // tidy-alphabetical-end } |
