Rollup merge of #77107 - bugadani:perf, r=oli-obk
Enable const propagation into operands at mir_opt_level=2 Feature was added in #74507 but gated with `mir_opt_level>=3` because of compile time regressions. Let's see whether the LLVM 11 update solves that. As the [perf results](https://github.com/rust-lang/rust/pull/77107#issuecomment-697668154) show, enabling this optimization results in a lot less regression as before. cc @oli-obk r? @ghost
This commit is contained in:
commit
6b8fb3fbd8
@ -1046,9 +1046,9 @@ fn visit_body(&mut self, body: &mut Body<'tcx>) {
|
||||
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
|
||||
self.super_operand(operand, location);
|
||||
|
||||
// Only const prop copies and moves on `mir_opt_level=3` as doing so
|
||||
// currently increases compile time.
|
||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 3 {
|
||||
// Only const prop copies and moves on `mir_opt_level=2` as doing so
|
||||
// currently slightly increases compile time in some cases.
|
||||
if self.tcx.sess.opts.debugging_opts.mir_opt_level >= 2 {
|
||||
self.propagate_operand(operand)
|
||||
}
|
||||
}
|
||||
@ -1246,8 +1246,8 @@ fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
| TerminatorKind::InlineAsm { .. } => {}
|
||||
// Every argument in our function calls have already been propagated in `visit_operand`.
|
||||
//
|
||||
// NOTE: because LLVM codegen gives performance regressions with it, so this is gated
|
||||
// on `mir_opt_level=3`.
|
||||
// NOTE: because LLVM codegen gives slight performance regressions with it, so this is
|
||||
// gated on `mir_opt_level=2`.
|
||||
TerminatorKind::Call { .. } => {}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user