Skip to content

Commit

Permalink
a wild commit has appeared!
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed Oct 24, 2021
1 parent 00d5e42 commit 19898d6
Show file tree
Hide file tree
Showing 15 changed files with 806 additions and 1 deletion.
7 changes: 7 additions & 0 deletions compiler/rustc_middle/src/mir/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,13 @@ impl<'tcx> TerminatorKind<'tcx> {
}
}

pub fn switch_targets_mut(&mut self) -> Option<&mut SwitchTargets> {
match self {
TerminatorKind::SwitchInt { targets, .. } => Some(targets),
_ => None,
}
}

pub fn as_goto(&self) -> Option<BasicBlock> {
match self {
TerminatorKind::Goto { target } => Some(*target),
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_mir_dataflow/src/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ impl EffectIndex {
}
}

#[derive(Debug)]
pub struct SwitchIntTarget {
pub value: Option<u128>,
pub target: BasicBlock,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub use self::drop_flag_effects::{
pub use self::framework::{
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, Direction, Engine,
Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results, ResultsCursor, ResultsRefCursor,
ResultsVisitable, ResultsVisitor,
ResultsVisitable, ResultsVisitor, SwitchIntEdgeEffects,
};

use self::move_paths::MoveData;
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_mir_transform/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(never_type)]
#![feature(trusted_step)]
#![feature(try_blocks)]
#![feature(if_let_guard)]
#![recursion_limit = "256"]
#![cfg_attr(not(bootstrap), allow(rustc::potential_query_instability))]

Expand Down Expand Up @@ -62,6 +63,7 @@ mod match_branches;
mod multiple_return_terminators;
mod normalize_array_len;
mod nrvo;
mod refinements;
mod remove_noop_landing_pads;
mod remove_storage_markers;
mod remove_unneeded_drops;
Expand Down Expand Up @@ -507,6 +509,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {

// The main optimizations that we do on MIR.
let optimizations: &[&dyn MirPass<'tcx>] = &[
&refinements::Refinements,
&remove_storage_markers::RemoveStorageMarkers,
&remove_zsts::RemoveZsts,
&const_goto::ConstGoto,
Expand Down
Loading

0 comments on commit 19898d6

Please sign in to comment.