diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-05-16 02:07:31 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-05-17 20:33:02 -0700 |
| commit | 95c0e5c6a86ca467b0fb7043bd56dee82418ac5f (patch) | |
| tree | 961ac9359e2a2d7edcf81a1f97a7ef0a5514e096 /compiler/rustc_codegen_cranelift/src/base.rs | |
| parent | 8e78d168040b2d7106a28712c39106602c7a1d61 (diff) | |
| download | rust-95c0e5c6a86ca467b0fb7043bd56dee82418ac5f.tar.gz rust-95c0e5c6a86ca467b0fb7043bd56dee82418ac5f.zip | |
Remove `Rvalue::CheckedBinaryOp`
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/base.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/base.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 5846689643f..8d778f736d6 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -609,14 +609,11 @@ fn codegen_stmt<'tcx>( let lhs = codegen_operand(fx, &lhs_rhs.0); let rhs = codegen_operand(fx, &lhs_rhs.1); - let res = crate::num::codegen_binop(fx, bin_op, lhs, rhs); - lval.write_cvalue(fx, res); - } - Rvalue::CheckedBinaryOp(bin_op, ref lhs_rhs) => { - let lhs = codegen_operand(fx, &lhs_rhs.0); - let rhs = codegen_operand(fx, &lhs_rhs.1); - - let res = crate::num::codegen_checked_int_binop(fx, bin_op, lhs, rhs); + let res = if let Some(bin_op) = bin_op.overflowing_to_wrapping() { + crate::num::codegen_checked_int_binop(fx, bin_op, lhs, rhs) + } else { + crate::num::codegen_binop(fx, bin_op, lhs, rhs) + }; lval.write_cvalue(fx, res); } Rvalue::UnaryOp(un_op, ref operand) => { |
