@@ -612,7 +612,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
612612 && bb_l. terminator ( ) . kind == bb_r. terminator ( ) . kind ;
613613 let statement_check = || {
614614 bb_l. statements . iter ( ) . zip ( & bb_r. statements ) . try_fold ( StatementEquality :: TrivialEqual , |acc, ( l, r) | {
615- let stmt_equality = self . statement_equality ( * adt_matched_on, & l, bb_l_idx, & r, bb_r_idx, self . tcx . sess . opts . debugging_opts . mir_opt_level ) ;
615+ let stmt_equality = self . statement_equality ( * adt_matched_on, & l, bb_l_idx, & r, bb_r_idx, self . tcx ) ;
616616 if matches ! ( stmt_equality, StatementEquality :: NotEqual ) {
617617 // short circuit
618618 None
@@ -672,7 +672,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
672672 x_bb_idx : BasicBlock ,
673673 y : & Statement < ' tcx > ,
674674 y_bb_idx : BasicBlock ,
675- mir_opt_level : usize ,
675+ tcx : TyCtxt < ' tcx > ,
676676 ) -> StatementEquality {
677677 let helper = |rhs : & Rvalue < ' tcx > ,
678678 place : & Place < ' tcx > ,
@@ -693,7 +693,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
693693 Rvalue :: Use ( operand) if operand. place ( ) == Some ( adt_matched_on) => {
694694 // FIXME(76803): This logic is currently broken because it does not take into
695695 // account the current discriminant value.
696- if mir_opt_level > 2 {
696+ if tcx . sess . opts . debugging_opts . unsound_mir_opts {
697697 StatementEquality :: ConsideredEqual ( side_to_choose)
698698 } else {
699699 StatementEquality :: NotEqual
0 commit comments