Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnreachableProp: Preserve unreachable branches for multiple targets #99762

Merged
merged 3 commits into from
Aug 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
Noratrieb committed Aug 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bc79557311f068cbd97e77507797d912dc637180
5 changes: 2 additions & 3 deletions compiler/rustc_mir_transform/src/unreachable_prop.rs
Original file line number Diff line number Diff line change
@@ -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>) {