diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-12-23 17:48:31 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-23 17:48:31 +0100 |
| commit | 8a61ae0479ddfb14005d0f1502515ed93be1d1ac (patch) | |
| tree | 50ac72acd490adbf7c52aad5cdfaceba311188a3 /compiler/rustc_codegen_ssa/src | |
| parent | cf7ee6974e01aa90881dcd043628db0ef32156c4 (diff) | |
| parent | cac431ba750c4f079690731b976bc67d979cb8e3 (diff) | |
| download | rust-8a61ae0479ddfb14005d0f1502515ed93be1d1ac.tar.gz rust-8a61ae0479ddfb14005d0f1502515ed93be1d1ac.zip | |
Rollup merge of #92203 - Aaron1011:mir-adt-def, r=oli-obk
Store a `DefId` instead of an `AdtDef` in `AggregateKind::Adt` The `AggregateKind` enum ends up in the final mir `Body`. Currently, any changes to `AdtDef` (regardless of how significant they are) will legitimately cause the overall result of `optimized_mir` to change, invalidating any codegen re-use involving that mir. This will get worse once we start hashing the `Span` inside `FieldDef` (which is itself contained in `AdtDef`). To try to reduce these kinds of invalidations, this commit changes `AggregateKind::Adt` to store just the `DefId`, instead of the full `AdtDef`. This allows the result of `optimized_mir` to be unchanged if the `AdtDef` changes in a way that doesn't actually affect any of the MIR we build.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index f087b9f7815..6f960ca44cd 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -112,9 +112,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { mir::Rvalue::Aggregate(ref kind, ref operands) => { let (dest, active_field_index) = match **kind { - mir::AggregateKind::Adt(adt_def, variant_index, _, _, active_field_index) => { + mir::AggregateKind::Adt(adt_did, variant_index, _, _, active_field_index) => { dest.codegen_set_discr(&mut bx, variant_index); - if adt_def.is_enum() { + if bx.tcx().adt_def(adt_did).is_enum() { (dest.project_downcast(&mut bx, variant_index), active_field_index) } else { (dest, active_field_index) |
