Skip to content

Commit 3c05740

Browse files
committed
Auto merge of #117206 - cjgillot:jump-threading-default, r=<try>
PERF: Enable MIR JumpThreading by default Mostly for perf r? `@ghost`
2 parents 104ac7b + a7ccf80 commit 3c05740

25 files changed

+361
-1091
lines changed

compiler/rustc_const_eval/src/transform/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CfgChecker<'a, 'tcx> {
296296
);
297297
}
298298

299-
if self.reachable_blocks.contains(location.block) && context.is_use() {
299+
if false && self.reachable_blocks.contains(location.block) && context.is_use() {
300300
// We check that the local is live whenever it is used. Technically, violating this
301301
// restriction is only UB and not actually indicative of not well-formed MIR. This means
302302
// that an optimization which turns MIR that already has UB into MIR that fails this

compiler/rustc_mir_transform/src/const_goto.rs

-129
This file was deleted.

compiler/rustc_mir_transform/src/jump_threading.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const MAX_PLACES: usize = 100;
5555

5656
impl<'tcx> MirPass<'tcx> for JumpThreading {
5757
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
58-
sess.mir_opt_level() >= 4
58+
sess.mir_opt_level() >= 2
5959
}
6060

6161
#[instrument(skip_all level = "debug")]

compiler/rustc_mir_transform/src/lib.rs

-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ mod remove_place_mention;
5757
mod add_subtyping_projections;
5858
pub mod cleanup_post_borrowck;
5959
mod const_debuginfo;
60-
mod const_goto;
6160
mod const_prop;
6261
mod const_prop_lint;
6362
mod copy_prop;
@@ -99,7 +98,6 @@ mod remove_unneeded_drops;
9998
mod remove_zsts;
10099
mod required_consts;
101100
mod reveal_all;
102-
mod separate_const_switch;
103101
mod shim;
104102
mod ssa;
105103
// This pass is public to allow external drivers to perform MIR cleanup
@@ -554,7 +552,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
554552
&remove_storage_markers::RemoveStorageMarkers,
555553
&remove_zsts::RemoveZsts,
556554
&normalize_array_len::NormalizeArrayLen, // has to run after `slice::len` lowering
557-
&const_goto::ConstGoto,
558555
&remove_unneeded_drops::RemoveUnneededDrops,
559556
&ref_prop::ReferencePropagation,
560557
&sroa::ScalarReplacementOfAggregates,
@@ -564,10 +561,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
564561
&instsimplify::InstSimplify,
565562
&simplify::SimplifyLocals::BeforeConstProp,
566563
&copy_prop::CopyProp,
567-
// Perform `SeparateConstSwitch` after SSA-based analyses, as cloning blocks may
568-
// destroy the SSA property. It should still happen before const-propagation, so the
569-
// latter pass will leverage the created opportunities.
570-
&separate_const_switch::SeparateConstSwitch,
571564
&const_prop::ConstProp,
572565
&gvn::GVN,
573566
&dataflow_const_prop::DataflowConstProp,

0 commit comments

Comments
 (0)