Skip to content

Commit

Permalink
debuginfo: Get rid of redundant argument copying with debuginfo activ…
Browse files Browse the repository at this point in the history
…ated
  • Loading branch information
michaelwoerister committed Dec 16, 2013
1 parent 7eae649 commit 45e472a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/librustc/middle/trans/_match.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 45e472a

Please sign in to comment.