about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-07-26 15:15:07 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-08-21 21:15:28 +0200
commitbc79557311f068cbd97e77507797d912dc637180 (patch)
treed9f30f31ba95fbcbbc0a8d00de0eb1d89b383aeb
parenteafab660964bcd1e2c8b19cc2021cc5c7fee6c38 (diff)
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.
-rw-r--r--compiler/rustc_mir_transform/src/unreachable_prop.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs
index a7e522beeab..56d7799a125 100644
--- a/compiler/rustc_mir_transform/src/unreachable_prop.rs
+++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs
@@ -12,9 +12,8 @@ pub struct UnreachablePropagation;
 
 impl MirPass<'_> for UnreachablePropagation {
     fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
-        // Enable only under -Zmir-opt-level=4 as in some cases (check the deeply-nested-opt
-        // perf benchmark) LLVM may spend quite a lot of time optimizing the generated code.
-        sess.mir_opt_level() >= 4
+        // Enable only under -Zmir-opt-level=2 as this can make programs less debuggable.
+        sess.mir_opt_level() >= 2
     }
 
     fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {