@@ -22,7 +22,6 @@ use rustc_middle::ty::subst::{InternalSubsts, Subst};
2222use rustc_middle:: ty:: {
2323 self , ConstInt , ConstKind , Instance , ParamEnv , ScalarInt , Ty , TyCtxt , TypeFoldable ,
2424} ;
25- use rustc_session:: config:: MIR_OPT_LEVEL_DEFAULT ;
2625use rustc_session:: lint;
2726use rustc_span:: { def_id:: DefId , Span } ;
2827use rustc_target:: abi:: { HasDataLayout , LayoutOf , Size , TargetDataLayout } ;
@@ -709,7 +708,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
709708 return None ;
710709 }
711710
712- if self . tcx . sess . opts . debugging_opts . mir_opt_level . unwrap_or ( MIR_OPT_LEVEL_DEFAULT ) >= 3 {
711+ if self . tcx . sess . opts . debugging_opts . mir_opt_level >= 3 {
713712 self . eval_rvalue_with_identities ( rvalue, place)
714713 } else {
715714 self . use_ecx ( |this| this. ecx . eval_rvalue_into_place ( rvalue, place) )
@@ -887,8 +886,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
887886
888887 /// Returns `true` if and only if this `op` should be const-propagated into.
889888 fn should_const_prop ( & mut self , op : OpTy < ' tcx > ) -> bool {
890- let mir_opt_level =
891- self . tcx . sess . opts . debugging_opts . mir_opt_level . unwrap_or ( MIR_OPT_LEVEL_DEFAULT ) ;
889+ let mir_opt_level = self . tcx . sess . opts . debugging_opts . mir_opt_level ;
892890
893891 if mir_opt_level == 0 {
894892 return false ;
@@ -1058,7 +1056,7 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
10581056
10591057 // Only const prop copies and moves on `mir_opt_level=2` as doing so
10601058 // currently slightly increases compile time in some cases.
1061- if self . tcx . sess . opts . debugging_opts . mir_opt_level . unwrap_or ( MIR_OPT_LEVEL_DEFAULT ) >= 2 {
1059+ if self . tcx . sess . opts . debugging_opts . mir_opt_level >= 2 {
10621060 self . propagate_operand ( operand)
10631061 }
10641062 }
0 commit comments