librustc: Improve inlining behavior.

This commit is contained in:
Patrick Walton 2013-04-07 16:09:12 -07:00
parent ca8e99fd78
commit 0b0ca597bf

View File

@ -409,6 +409,15 @@ pub fn trans_expr_fn(bcx: block,
~"expr_fn");
let llfn = decl_internal_cdecl_fn(ccx.llmod, s, llfnty);
// Always mark inline if this is a loop body. This is important for
// performance on many programs with tight loops.
if is_loop_body.is_some() {
set_always_inline(llfn);
} else {
// Can't hurt.
set_inline_hint(llfn);
}
let Result {bcx: bcx, val: closure} = match sigil {
ast::BorrowedSigil | ast::ManagedSigil | ast::OwnedSigil => {
let cap_vars = *ccx.maps.capture_map.get(&user_id);