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.
This commit is contained in:
Nilstrieb 2022-07-26 15:15:07 +02:00
parent eafab66096
commit bc79557311

View File

@ -12,9 +12,8 @@
impl MirPass<'_> for UnreachablePropagation { impl MirPass<'_> for UnreachablePropagation {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool { 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 // Enable only under -Zmir-opt-level=2 as this can make programs less debuggable.
// perf benchmark) LLVM may spend quite a lot of time optimizing the generated code. sess.mir_opt_level() >= 2
sess.mir_opt_level() >= 4
} }
fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {