Skip to content

Commit 74f39b6

Browse files
committed
Avoid a temporary stackslot in codegen_checked_int_binop
1 parent b0f870e commit 74f39b6

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/num.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,11 @@ pub(crate) fn codegen_checked_int_binop<'tcx>(
328328

329329
let has_overflow = fx.bcx.ins().bint(types::I8, has_overflow);
330330

331-
// FIXME directly write to result place instead
332-
let out_place = CPlace::new_stack_slot(
333-
fx,
334-
fx.layout_of(
335-
fx.tcx
336-
.mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()),
337-
),
331+
let out_layout = fx.layout_of(
332+
fx.tcx
333+
.mk_tup([in_lhs.layout().ty, fx.tcx.types.bool].iter()),
338334
);
339-
let out_layout = out_place.layout();
340-
out_place.write_cvalue(fx, CValue::by_val_pair(res, has_overflow, out_layout));
341-
342-
out_place.to_cvalue(fx)
335+
CValue::by_val_pair(res, has_overflow, out_layout)
343336
}
344337

345338
pub(crate) fn codegen_float_binop<'tcx>(

0 commit comments

Comments
 (0)