only enable ConstProp on opt level 2
This commit is contained in:
parent
41ad4d9b2d
commit
099cb5ad8a
1 changed files with 2 additions and 11 deletions
|
@ -60,11 +60,8 @@ macro_rules! throw_machine_stop_str {
|
||||||
pub struct ConstProp;
|
pub struct ConstProp;
|
||||||
|
|
||||||
impl<'tcx> MirPass<'tcx> for ConstProp {
|
impl<'tcx> MirPass<'tcx> for ConstProp {
|
||||||
fn is_enabled(&self, _sess: &rustc_session::Session) -> bool {
|
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||||
// FIXME(#70073): Unlike the other passes in "optimizations", this one emits errors, so it
|
sess.mir_opt_level() >= 2
|
||||||
// runs even when MIR optimizations are disabled. We should separate the lint out from the
|
|
||||||
// transform and move the lint as early in the pipeline as possible.
|
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip(self, tcx), level = "debug")]
|
#[instrument(skip(self, tcx), level = "debug")]
|
||||||
|
@ -786,12 +783,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||||
|
|
||||||
/// Returns `true` if and only if this `op` should be const-propagated into.
|
/// Returns `true` if and only if this `op` should be const-propagated into.
|
||||||
fn should_const_prop(&mut self, op: &OpTy<'tcx>) -> bool {
|
fn should_const_prop(&mut self, op: &OpTy<'tcx>) -> bool {
|
||||||
let mir_opt_level = self.tcx.sess.mir_opt_level();
|
|
||||||
|
|
||||||
if mir_opt_level == 0 {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.tcx.consider_optimizing(|| format!("ConstantPropagation - OpTy: {:?}", op)) {
|
if !self.tcx.consider_optimizing(|| format!("ConstantPropagation - OpTy: {:?}", op)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue