@@ -612,7 +612,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
612
612
&& bb_l. terminator ( ) . kind == bb_r. terminator ( ) . kind ;
613
613
let statement_check = || {
614
614
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 ) ;
616
616
if matches ! ( stmt_equality, StatementEquality :: NotEqual ) {
617
617
// short circuit
618
618
None
@@ -672,7 +672,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
672
672
x_bb_idx : BasicBlock ,
673
673
y : & Statement < ' tcx > ,
674
674
y_bb_idx : BasicBlock ,
675
- mir_opt_level : usize ,
675
+ tcx : TyCtxt < ' tcx > ,
676
676
) -> StatementEquality {
677
677
let helper = |rhs : & Rvalue < ' tcx > ,
678
678
place : & Place < ' tcx > ,
@@ -693,7 +693,7 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
693
693
Rvalue :: Use ( operand) if operand. place ( ) == Some ( adt_matched_on) => {
694
694
// FIXME(76803): This logic is currently broken because it does not take into
695
695
// account the current discriminant value.
696
- if mir_opt_level > 2 {
696
+ if tcx . sess . opts . debugging_opts . unsound_mir_opts {
697
697
StatementEquality :: ConsideredEqual ( side_to_choose)
698
698
} else {
699
699
StatementEquality :: NotEqual
0 commit comments