Skip to content

Commit 9104c89

Browse files
committed
Auto merge of rust-lang#85869 - tmiasko:box-free, r=nagisa
Remove special handling of `box_free` from `LocalAnalyzer` The special casing of `box_free` predates the use of dominators in analyzer. It is no longer necessary now that analyzer verifies that the first assignment dominates all uses.
2 parents 5ea1923 + 76695c4 commit 9104c89

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

compiler/rustc_codegen_ssa/src/mir/analyze.rs

-29
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_middle::mir::visit::{
1111
MutatingUseContext, NonMutatingUseContext, NonUseContext, PlaceContext, Visitor,
1212
};
1313
use rustc_middle::mir::{self, Location, TerminatorKind};
14-
use rustc_middle::ty;
1514
use rustc_middle::ty::layout::HasTyCtxt;
1615
use rustc_target::abi::LayoutOf;
1716

@@ -228,34 +227,6 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
228227
self.visit_rvalue(rvalue, location);
229228
}
230229

231-
fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Location) {
232-
let check = match terminator.kind {
233-
mir::TerminatorKind::Call { func: mir::Operand::Constant(ref c), ref args, .. } => {
234-
match *c.ty().kind() {
235-
ty::FnDef(did, _) => Some((did, args)),
236-
_ => None,
237-
}
238-
}
239-
_ => None,
240-
};
241-
if let Some((def_id, args)) = check {
242-
if Some(def_id) == self.fx.cx.tcx().lang_items().box_free_fn() {
243-
// box_free(x) shares with `drop x` the property that it
244-
// is not guaranteed to be statically dominated by the
245-
// definition of x, so x must always be in an alloca.
246-
if let mir::Operand::Move(ref place) = args[0] {
247-
self.visit_place(
248-
place,
249-
PlaceContext::MutatingUse(MutatingUseContext::Drop),
250-
location,
251-
);
252-
}
253-
}
254-
}
255-
256-
self.super_terminator(terminator, location);
257-
}
258-
259230
fn visit_place(&mut self, place: &mir::Place<'tcx>, context: PlaceContext, location: Location) {
260231
debug!("visit_place(place={:?}, context={:?})", place, context);
261232
self.process_place(&place.as_ref(), context, location);

0 commit comments

Comments
 (0)