@@ -2028,9 +2028,21 @@ pub fn store_arg<'a>(mut bcx: &'a Block<'a>,
2028
2028
Some ( path) => {
2029
2029
// Generate nicer LLVM for the common case of fn a pattern
2030
2030
// like `x: T`
2031
- mk_binding_alloca (
2032
- bcx, pat. id , path, BindArgument , arg_scope, arg,
2033
- |arg, bcx, llval, _| arg. store_to ( bcx, llval) )
2031
+ let arg_ty = node_id_type ( bcx, pat. id ) ;
2032
+ if type_of:: arg_is_indirect ( bcx. ccx ( ) , arg_ty)
2033
+ && !bcx. ccx ( ) . sess . opts . extra_debuginfo {
2034
+ // Don't copy an indirect argument to an alloca, the caller
2035
+ // already put it in a temporary alloca and gave it up, unless
2036
+ // we emit extra-debug-info, which requires local allocas :(.
2037
+ let arg_val = arg. add_clean ( bcx. fcx , arg_scope) ;
2038
+ let mut llmap = bcx. fcx . llargs . borrow_mut ( ) ;
2039
+ llmap. get ( ) . insert ( pat. id , Datum ( arg_val, arg_ty, Lvalue ) ) ;
2040
+ bcx
2041
+ } else {
2042
+ mk_binding_alloca (
2043
+ bcx, pat. id , path, BindArgument , arg_scope, arg,
2044
+ |arg, bcx, llval, _| arg. store_to ( bcx, llval) )
2045
+ }
2034
2046
}
2035
2047
2036
2048
None => {
0 commit comments