1
Fork 0

Rename lint pass.

This commit is contained in:
Camille GILLOT 2023-10-01 13:49:19 +00:00
parent 7e1ecff56e
commit b1bef90d4f
2 changed files with 7 additions and 7 deletions

View file

@ -34,9 +34,9 @@ use crate::MirLint;
/// Severely regress performance. /// Severely regress performance.
const MAX_ALLOC_LIMIT: u64 = 1024; const MAX_ALLOC_LIMIT: u64 = 1024;
pub struct ConstProp; pub struct ConstPropLint;
impl<'tcx> MirLint<'tcx> for ConstProp { impl<'tcx> MirLint<'tcx> for ConstPropLint {
fn run_lint(&self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>) { fn run_lint(&self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
if body.tainted_by_errors.is_some() { if body.tainted_by_errors.is_some() {
return; return;
@ -55,18 +55,18 @@ impl<'tcx> MirLint<'tcx> for ConstProp {
// Only run const prop on functions, methods, closures and associated constants // Only run const prop on functions, methods, closures and associated constants
if !is_fn_like && !is_assoc_const { if !is_fn_like && !is_assoc_const {
// skip anon_const/statics/consts because they'll be evaluated by miri anyway // skip anon_const/statics/consts because they'll be evaluated by miri anyway
trace!("ConstProp skipped for {:?}", def_id); trace!("ConstPropLint skipped for {:?}", def_id);
return; return;
} }
// FIXME(welseywiser) const prop doesn't work on generators because of query cycles // FIXME(welseywiser) const prop doesn't work on generators because of query cycles
// computing their layout. // computing their layout.
if let DefKind::Generator = def_kind { if let DefKind::Generator = def_kind {
trace!("ConstProp skipped for generator {:?}", def_id); trace!("ConstPropLint skipped for generator {:?}", def_id);
return; return;
} }
trace!("ConstProp starting for {:?}", def_id); trace!("ConstPropLint starting for {:?}", def_id);
// FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold // FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold
// constants, instead of just checking for const-folding succeeding. // constants, instead of just checking for const-folding succeeding.
@ -75,7 +75,7 @@ impl<'tcx> MirLint<'tcx> for ConstProp {
let mut linter = ConstPropagator::new(body, tcx); let mut linter = ConstPropagator::new(body, tcx);
linter.visit_body(body); linter.visit_body(body);
trace!("ConstProp done for {:?}", def_id); trace!("ConstPropLint done for {:?}", def_id);
} }
} }

View file

@ -494,7 +494,7 @@ fn run_runtime_lowering_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
&elaborate_box_derefs::ElaborateBoxDerefs, &elaborate_box_derefs::ElaborateBoxDerefs,
&generator::StateTransform, &generator::StateTransform,
&add_retag::AddRetag, &add_retag::AddRetag,
&Lint(const_prop_lint::ConstProp), &Lint(const_prop_lint::ConstPropLint),
]; ];
pm::run_passes_no_validate(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::Initial))); pm::run_passes_no_validate(tcx, body, passes, Some(MirPhase::Runtime(RuntimePhase::Initial)));
} }