Skip to content

Commit 6b2df76

Browse files
debuginfo: Always copy args to allocas if debuginfo is enabled
1 parent c19f493 commit 6b2df76

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/librustc/middle/trans/_match.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,19 +2000,17 @@ pub fn store_arg(mut bcx: @mut Block,
20002000
let arg_ty = node_id_type(bcx, pat.id);
20012001
add_clean(bcx, llval, arg_ty);
20022002

2003-
match simple_identifier(pat) {
2004-
Some(_) => {
2005-
// Optimized path for `x: T` case. This just adopts
2006-
// `llval` wholesale as the pointer for `x`, avoiding the
2007-
// general logic which may copy out of `llval`.
2008-
bcx.fcx.llargs.insert(pat.id, llval);
2009-
}
2003+
let fast_path = !bcx.ccx().sess.opts.extra_debuginfo && simple_identifier(pat).is_some();
20102004

2011-
None => {
2012-
// General path. Copy out the values that are used in the
2013-
// pattern.
2014-
bcx = bind_irrefutable_pat(bcx, pat, llval, BindArgument);
2015-
}
2005+
if fast_path {
2006+
// Optimized path for `x: T` case. This just adopts
2007+
// `llval` wholesale as the pointer for `x`, avoiding the
2008+
// general logic which may copy out of `llval`.
2009+
bcx.fcx.llargs.insert(pat.id, llval);
2010+
} else {
2011+
// General path. Copy out the values that are used in the
2012+
// pattern.
2013+
bcx = bind_irrefutable_pat(bcx, pat, llval, BindArgument);
20162014
}
20172015

20182016
return bcx;

0 commit comments

Comments
 (0)