Skip to content

Commit 4f13aa7

Browse files
committed
Comment codegen optimization.
1 parent 328696c commit 4f13aa7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
656656
// with #[rustc_inherit_overflow_checks] and inlined from
657657
// another crate (mostly core::num generic/#[inline] fns),
658658
// while the current crate doesn't use overflow checks.
659+
//
660+
// As an optimization, we emit an unchecked binop when overflow checks are disabled,
661+
// as the overflow flag would be ignored anyway.
659662
if !bx.cx().check_overflow() {
660663
let val = self.codegen_scalar_binop(bx, op, lhs, rhs, input_ty);
661664
return OperandValue::Pair(val, bx.cx().const_bool(false));

0 commit comments

Comments
 (0)