1
Fork 0

Avoid a temporary stackslot in codegen_checked_int_binop

This commit is contained in:
bjorn3 2021-02-21 12:48:43 +01:00
parent b0f870edd6
commit 74f39b64c8

View file

@ -328,18 +328,11 @@ pub(crate) fn codegen_checked_int_binop<'tcx>(
let has_overflow = fx.bcx.ins().bint(types::I8, has_overflow); let has_overflow = fx.bcx.ins().bint(types::I8, has_overflow);
// FIXME directly write to result place instead let out_layout = fx.layout_of(
let out_place = CPlace::new_stack_slot( fx.tcx
fx, .mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()),
fx.layout_of(
fx.tcx
.mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()),
),
); );
let out_layout = out_place.layout(); CValue::by_val_pair(res, has_overflow, out_layout)
out_place.write_cvalue(fx, CValue::by_val_pair(res, has_overflow, out_layout));
out_place.to_cvalue(fx)
} }
pub(crate) fn codegen_float_binop<'tcx>( pub(crate) fn codegen_float_binop<'tcx>(