mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
avoid extra load for by_mutable_ref parameters
This commit is contained in:
parent
7ab6315f5f
commit
80102c9d24
@ -3848,8 +3848,7 @@ fn trans_c_stack_native_call(bcx: @block_ctxt, f: @ast::expr,
|
|||||||
|
|
||||||
let r = trans_arg_expr(bcx, ty_arg, llargty, to_zero, to_revoke, arg);
|
let r = trans_arg_expr(bcx, ty_arg, llargty, to_zero, to_revoke, arg);
|
||||||
let llargval = r.val; bcx = r.bcx;
|
let llargval = r.val; bcx = r.bcx;
|
||||||
{ llval: llargval, llty: llargty, static: static,
|
{ llval: llargval, llty: llargty, static: static, mode: ty_arg.mode }
|
||||||
by_val: ty_arg.mode == ast::by_val }
|
|
||||||
}, fn_arg_tys, args);
|
}, fn_arg_tys, args);
|
||||||
|
|
||||||
// Allocate the argument bundle.
|
// Allocate the argument bundle.
|
||||||
@ -3865,7 +3864,10 @@ fn trans_c_stack_native_call(bcx: @block_ctxt, f: @ast::expr,
|
|||||||
if llarg.static {
|
if llarg.static {
|
||||||
// FIXME: This load is unfortunate. It won't be necessary once we
|
// FIXME: This load is unfortunate. It won't be necessary once we
|
||||||
// have reference types again.
|
// have reference types again.
|
||||||
llargval = llarg.by_val ? llarg.llval : Load(bcx, llarg.llval);
|
llargval = alt llarg.mode {
|
||||||
|
ast::by_val. | ast::by_mut_ref. { llarg.llval }
|
||||||
|
ast::by_ref. | ast::mode_infer. { Load(bcx, llarg.llval) }
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
llargval = llarg.llval;
|
llargval = llarg.llval;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ import std::str::sbuf;
|
|||||||
import lib::llvm::llvm;
|
import lib::llvm::llvm;
|
||||||
import llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, Opcode,
|
import llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, Opcode,
|
||||||
ModuleRef};
|
ModuleRef};
|
||||||
import trans_common::{block_ctxt, T_ptr, T_nil, T_int, T_i8, T_i1, val_ty};
|
import trans_common::{block_ctxt, T_ptr, T_nil, T_int, T_i8, T_i1,
|
||||||
|
val_ty, val_str, bcx_ccx};
|
||||||
|
|
||||||
fn B(cx: @block_ctxt) -> BuilderRef {
|
fn B(cx: @block_ctxt) -> BuilderRef {
|
||||||
let b = *cx.fcx.lcx.ccx.builder;
|
let b = *cx.fcx.lcx.ccx.builder;
|
||||||
|
Loading…
Reference in New Issue
Block a user