Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit db9b05a

Browse files
committedApr 22, 2020
Auto merge of rust-lang#71044 - ecstatic-morse:body-predecessor-cache, r=oli-obk
Remove `BodyAndCache` ...returning to the original approach using interior mutability within `Body`. This simplifies the API at the cost of some uncontended mutex locks when the parallel compiler is enabled. The current API requires you to either have a mutable reference to `Body` (`&mut BodyAndCache`), or to compute the predecessor graph ahead of time by creating a `ReadOnlyBodyAndCache`. This is not a good fit for, e.g., the dataflow framework, which 1. does not mutate the MIR 2. only sometimes needs the predecessor graph (for backward dataflow problems)
2 parents b2e36e6 + 4e7469e commit db9b05a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+454
-684
lines changed
 

‎src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
120120
};
121121
if is_consume {
122122
let base_ty =
123-
mir::Place::ty_from(place_ref.local, proj_base, *self.fx.mir, cx.tcx());
123+
mir::Place::ty_from(place_ref.local, proj_base, self.fx.mir, cx.tcx());
124124
let base_ty = self.fx.monomorphize(&base_ty);
125125

126126
// ZSTs don't require any actual memory access.

‎src/librustc_codegen_ssa/mir/block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
152152
// a loop.
153153
fn maybe_sideeffect<Bx: BuilderMethods<'a, 'tcx>>(
154154
&self,
155-
mir: mir::ReadOnlyBodyAndCache<'tcx, 'tcx>,
155+
mir: &'tcx mir::Body<'tcx>,
156156
bx: &mut Bx,
157157
targets: &[mir::BasicBlock],
158158
) {
@@ -306,7 +306,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
306306
target: mir::BasicBlock,
307307
unwind: Option<mir::BasicBlock>,
308308
) {
309-
let ty = location.ty(*self.mir, bx.tcx()).ty;
309+
let ty = location.ty(self.mir, bx.tcx()).ty;
310310
let ty = self.monomorphize(&ty);
311311
let drop_fn = Instance::resolve_drop_in_place(bx.tcx(), ty);
312312

@@ -572,7 +572,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
572572
let extra_args = extra_args
573573
.iter()
574574
.map(|op_arg| {
575-
let op_ty = op_arg.ty(*self.mir, bx.tcx());
575+
let op_ty = op_arg.ty(self.mir, bx.tcx());
576576
self.monomorphize(&op_ty)
577577
})
578578
.collect::<Vec<_>>();

0 commit comments

Comments
 (0)
This repository has been archived.