Skip to content

Commit

Permalink
nit: consistent naming for SimplifyConstCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Apr 21, 2023
1 parent fa4cc63 commit 6f29a3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,12 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
//
// Const-prop runs unconditionally, but doesn't mutate the MIR at mir-opt-level=0.
&const_debuginfo::ConstDebugInfo,
&o1(simplify_branches::SimplifyConstConditionPassName::AfterConstProp),
&o1(simplify_branches::SimplifyConstCondition::AfterConstProp),
&early_otherwise_branch::EarlyOtherwiseBranch,
&simplify_comparison_integral::SimplifyComparisonIntegral,
&dead_store_elimination::DeadStoreElimination,
&dest_prop::DestinationPropagation,
&o1(simplify_branches::SimplifyConstConditionPassName::Final),
&o1(simplify_branches::SimplifyConstCondition::Final),
&o1(remove_noop_landing_pads::RemoveNoopLandingPads),
&o1(simplify::SimplifyCfg::Final),
&nrvo::RenameReturnPlace,
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_mir_transform/src/simplify_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ use crate::MirPass;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;

pub enum SimplifyConstConditionPassName {
pub enum SimplifyConstCondition {
AfterConstProp,
Final,
}
/// A pass that replaces a branch with a goto when its condition is known.
impl<'tcx> MirPass<'tcx> for SimplifyConstConditionPassName {
impl<'tcx> MirPass<'tcx> for SimplifyConstCondition {
fn name(&self) -> &'static str {
match self {
SimplifyConstConditionPassName::AfterConstProp => {
"SimplifyConstCondition-after-const-prop"
}
SimplifyConstConditionPassName::Final => "SimplifyConstCondition-final",
SimplifyConstCondition::AfterConstProp => "SimplifyConstCondition-after-const-prop",
SimplifyConstCondition::Final => "SimplifyConstCondition-final",
}
}

Expand Down

0 comments on commit 6f29a3c

Please sign in to comment.