From 6b2df76c244d1cd282dd724135c4bdcb6e28eb52 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 3 Sep 2013 11:53:06 +0200 Subject: [PATCH] debuginfo: Always copy args to allocas if debuginfo is enabled --- src/librustc/middle/trans/_match.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index ad0ab95ebf0f..bc4cc2ce0e16 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -2000,19 +2000,17 @@ pub fn store_arg(mut bcx: @mut Block, let arg_ty = node_id_type(bcx, pat.id); add_clean(bcx, llval, arg_ty); - match simple_identifier(pat) { - Some(_) => { - // Optimized path for `x: T` case. This just adopts - // `llval` wholesale as the pointer for `x`, avoiding the - // general logic which may copy out of `llval`. - bcx.fcx.llargs.insert(pat.id, llval); - } + let fast_path = !bcx.ccx().sess.opts.extra_debuginfo && simple_identifier(pat).is_some(); - None => { - // General path. Copy out the values that are used in the - // pattern. - bcx = bind_irrefutable_pat(bcx, pat, llval, BindArgument); - } + if fast_path { + // Optimized path for `x: T` case. This just adopts + // `llval` wholesale as the pointer for `x`, avoiding the + // general logic which may copy out of `llval`. + bcx.fcx.llargs.insert(pat.id, llval); + } else { + // General path. Copy out the values that are used in the + // pattern. + bcx = bind_irrefutable_pat(bcx, pat, llval, BindArgument); } return bcx;