rustc_codegen_ssa: don't treat inlined variables as debuginfo arguments.

This commit is contained in:
Eduard-Mihai Burtescu 2020-02-03 19:42:39 +02:00
parent bdd946df3a
commit 80515f7528
2 changed files with 12 additions and 4 deletions

View File

@ -307,11 +307,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let var_ty = self.monomorphized_place_ty(place.as_ref()); let var_ty = self.monomorphized_place_ty(place.as_ref());
let var_kind = if self.mir.local_kind(place.local) == mir::LocalKind::Arg let var_kind = if self.mir.local_kind(place.local) == mir::LocalKind::Arg
&& place.projection.is_empty() && place.projection.is_empty()
&& var.source_info.scope == mir::OUTERMOST_SOURCE_SCOPE
{ {
// FIXME(eddyb, #67586) take `var.source_info.scope` into
// account to avoid using `ArgumentVariable` more than once
// per argument local.
let arg_index = place.local.index() - 1; let arg_index = place.local.index() - 1;
// FIXME(eddyb) shouldn't `ArgumentVariable` indices be // FIXME(eddyb) shouldn't `ArgumentVariable` indices be

View File

@ -0,0 +1,11 @@
// run-pass
// compile-flags: -Z mir-opt-level=2 -C opt-level=0 -C debuginfo=2
#[inline(never)]
pub fn foo(bar: usize) -> usize {
std::convert::identity(bar)
}
fn main() {
foo(0);
}