Skip to content

Commit 2e36c84

Browse files
TheOregonTrailbjorn3
authored andcommitted
Remove unreachable unit tuple compare binop codegen
1 parent c491875 commit 2e36c84

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/librustc_codegen_ssa/mir/rvalue.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
556556
) -> Bx::Value {
557557
let is_float = input_ty.is_floating_point();
558558
let is_signed = input_ty.is_signed();
559-
let is_unit = input_ty.is_unit();
560559
match op {
561560
mir::BinOp::Add => if is_float {
562561
bx.fadd(lhs, rhs)
@@ -594,13 +593,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
594593
mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
595594
mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
596595
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
597-
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
598-
bx.cx().const_bool(match op {
599-
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
600-
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
601-
_ => unreachable!()
602-
})
603-
} else if is_float {
596+
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_float {
604597
bx.fcmp(
605598
base::bin_op_to_fcmp_predicate(op.to_hir_binop()),
606599
lhs, rhs

0 commit comments

Comments
 (0)