1
Fork 0

Use FieldIdx in various things related to aggregates

Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
This commit is contained in:
Scott McMurray 2023-04-01 20:11:38 -07:00
parent 480068c235
commit b5b6def021
13 changed files with 51 additions and 46 deletions

View file

@ -274,7 +274,7 @@ impl<'tcx> TransformVisitor<'tcx> {
statements.push(Statement {
kind: StatementKind::Assign(Box::new((
Place::return_place(),
Rvalue::Aggregate(Box::new(kind), vec![]),
Rvalue::Aggregate(Box::new(kind), IndexVec::new()),
))),
source_info,
});
@ -287,7 +287,7 @@ impl<'tcx> TransformVisitor<'tcx> {
statements.push(Statement {
kind: StatementKind::Assign(Box::new((
Place::return_place(),
Rvalue::Aggregate(Box::new(kind), vec![val]),
Rvalue::Aggregate(Box::new(kind), IndexVec::from_iter([val])),
))),
source_info,
});