Skip to content

Commit bc79557

Browse files
committed
Enable UnreachablePropagation under mir-opt-level >= 2
It was disabled because of pathological behaviour of LLVM in some benchmarks. As of #77680, this has been fixed. The problem there was that it caused pessimizations in some cases. These have now been fixed as well.
1 parent eafab66 commit bc79557

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_mir_transform/src/unreachable_prop.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ pub struct UnreachablePropagation;
1212

1313
impl MirPass<'_> for UnreachablePropagation {
1414
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
15-
// Enable only under -Zmir-opt-level=4 as in some cases (check the deeply-nested-opt
16-
// perf benchmark) LLVM may spend quite a lot of time optimizing the generated code.
17-
sess.mir_opt_level() >= 4
15+
// Enable only under -Zmir-opt-level=2 as this can make programs less debuggable.
16+
sess.mir_opt_level() >= 2
1817
}
1918

2019
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {

0 commit comments

Comments
 (0)