Skip to content

Commit 543d33e

Browse files
committed
Auto merge of #63906 - luigishat:cmp_fix, r=bjorn3
Attempted fix to issue #63551 Well this is my first PR so hopefully I didn't do too bad. As said I'm attempting to fix issue #63551 and remove the unnecessary check for is_unit. would recommend removing `let is_unit = input_ty.is_unit()` unless there is another use.
2 parents 64c0969 + 4b57287 commit 543d33e

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
@@ -546,7 +546,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
546546
) -> Bx::Value {
547547
let is_float = input_ty.is_floating_point();
548548
let is_signed = input_ty.is_signed();
549-
let is_unit = input_ty.is_unit();
550549
match op {
551550
mir::BinOp::Add => if is_float {
552551
bx.fadd(lhs, rhs)
@@ -584,13 +583,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
584583
mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
585584
mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
586585
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
587-
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
588-
bx.cx().const_bool(match op {
589-
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
590-
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
591-
_ => unreachable!()
592-
})
593-
} else if is_float {
586+
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_float {
594587
bx.fcmp(
595588
base::bin_op_to_fcmp_predicate(op.to_hir_binop()),
596589
lhs, rhs

0 commit comments

Comments
 (0)