From 74f39b64c8d6a1395c6029d59d50342f80cae04e Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sun, 21 Feb 2021 12:48:43 +0100 Subject: [PATCH] Avoid a temporary stackslot in codegen_checked_int_binop --- src/num.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/num.rs b/src/num.rs index 4cce853d4b0..850ff3561f7 100644 --- a/src/num.rs +++ b/src/num.rs @@ -328,18 +328,11 @@ pub(crate) fn codegen_checked_int_binop<'tcx>( let has_overflow = fx.bcx.ins().bint(types::I8, has_overflow); - // FIXME directly write to result place instead - let out_place = CPlace::new_stack_slot( - fx, - fx.layout_of( - fx.tcx - .mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()), - ), + let out_layout = fx.layout_of( + fx.tcx + .mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()), ); - let out_layout = out_place.layout(); - out_place.write_cvalue(fx, CValue::by_val_pair(res, has_overflow, out_layout)); - - out_place.to_cvalue(fx) + CValue::by_val_pair(res, has_overflow, out_layout) } pub(crate) fn codegen_float_binop<'tcx>(