Skip to content

Commit a4d0bed

Browse files
Ignore VarDebugInfo when forcing locals on the stack
1 parent 7fcd4cb commit a4d0bed

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

src/librustc_codegen_ssa/mir/analyze.rs

+1-28
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
2525
analyzer.visit_basic_block_data(block, data);
2626
}
2727

28-
for debuginfo in mir.var_debug_info.iter() {
29-
analyzer.visit_var_debug_info(debuginfo);
30-
}
31-
3228
for (local, decl) in mir.local_decls.iter_enumerated() {
3329
let ty = fx.monomorphize(&decl.ty);
3430
debug!("local {:?} has type `{}`", local, ty);
@@ -143,9 +139,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
143139
) {
144140
debug!("visit_place(place={:?}, context={:?})", place, context);
145141

146-
// Except for `VarDebugInfo`, non-uses do not force locals onto the stack.
147-
//
148-
// `VarDebugInfo` is handled in `visit_var_debug_info`.
142+
// Non-uses do not force locals onto the stack.
149143
if !context.is_use() {
150144
return;
151145
}
@@ -259,27 +253,6 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
259253
}
260254
}
261255
}
262-
263-
fn visit_var_debug_info(&mut self, var_debug_info: &mir::VarDebugInfo<'tcx>) {
264-
// Indirect debuginfo requires going through memory, that only
265-
// the debugger accesses, following our emitted DWARF pointer ops.
266-
//
267-
// FIXME(eddyb) Investigate the possibility of relaxing this, but
268-
// note that `llvm.dbg.declare` *must* be used for indirect places,
269-
// even if we start using `llvm.dbg.value` for all other cases,
270-
// as we don't necessarily know when the value changes, but only
271-
// where it lives in memory.
272-
//
273-
// It's possible `llvm.dbg.declare` could support starting from
274-
// a pointer that doesn't point to an `alloca`, but this would
275-
// only be useful if we know the pointer being `Deref`'d comes
276-
// from an immutable place, and if `llvm.dbg.declare` calls
277-
// must be at the very start of the function, then only function
278-
// arguments could contain such pointers.
279-
if var_debug_info.place.is_indirect() {
280-
self.not_ssa(var_debug_info.place.local);
281-
}
282-
}
283256
}
284257

285258
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

0 commit comments

Comments
 (0)