about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@gmail>2013-12-13 13:19:11 +0100
committerMichael Woerister <michaelwoerister@gmail>2013-12-16 10:23:28 +0100
commit45e472aa4bdcec7a5bfd8cdaa10dd00435242162 (patch)
tree6f351bd2bffa2c1be56e8a15816c0aaac765a594
parent7eae649a015cd2e4c5764b2955edb7542410f1f1 (diff)
downloadrust-45e472aa4bdcec7a5bfd8cdaa10dd00435242162.tar.gz
rust-45e472aa4bdcec7a5bfd8cdaa10dd00435242162.zip
debuginfo: Get rid of redundant argument copying with debuginfo activated
-rw-r--r--src/librustc/middle/trans/_match.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs
index 091614b6bc7..745c9a2a29a 100644
--- a/src/librustc/middle/trans/_match.rs
+++ b/src/librustc/middle/trans/_match.rs
@@ -220,6 +220,7 @@ use util::common::indenter;
 use util::ppaux::{Repr, vec_map_to_str};
 
 use std::hashmap::HashMap;
+use std::ptr;
 use std::vec;
 use syntax::ast;
 use syntax::ast::Ident;
@@ -2046,7 +2047,10 @@ pub fn store_arg(mut bcx: @mut Block,
     // Debug information (the llvm.dbg.declare intrinsic to be precise) always expects to get an
     // alloca, which only is the case on the general path, so lets disable the optimized path when
     // debug info is enabled.
-    let fast_path = !bcx.ccx().sess.opts.extra_debuginfo && simple_identifier(pat).is_some();
+    let arg_is_alloca = unsafe { llvm::LLVMIsAAllocaInst(llval) != ptr::null() };
+
+    let fast_path = (arg_is_alloca || !bcx.ccx().sess.opts.extra_debuginfo)
+                    && simple_identifier(pat).is_some();
 
     if fast_path {
         // Optimized path for `x: T` case. This just adopts