]> git.lizzy.rs Git - rust.git/commitdiff
Remove unreachable unit tuple compare binop codegen
authorCaleb Behunin <calebrobot88@gmail.com>
Mon, 9 Sep 2019 05:17:10 +0000 (22:17 -0700)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sat, 19 Oct 2019 19:34:01 +0000 (21:34 +0200)
src/librustc_codegen_ssa/mir/rvalue.rs

index 27442bb6bff887f54d866f6fe090267d1e89e427..7e662ea37dbb410bd8c203c80ece30d3bf90792b 100644 (file)
@@ -556,7 +556,6 @@ pub fn codegen_scalar_binop(
     ) -> Bx::Value {
         let is_float = input_ty.is_floating_point();
         let is_signed = input_ty.is_signed();
-        let is_unit = input_ty.is_unit();
         match op {
             mir::BinOp::Add => if is_float {
                 bx.fadd(lhs, rhs)
@@ -594,13 +593,7 @@ pub fn codegen_scalar_binop(
             mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
             mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
             mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
-            mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
-                bx.cx().const_bool(match op {
-                    mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
-                    mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
-                    _ => unreachable!()
-                })
-            } else if is_float {
+            mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_float {
                 bx.fcmp(
                     base::bin_op_to_fcmp_predicate(op.to_hir_binop()),
                     lhs, rhs