Skip to content

Commit

Permalink
[perf] test perf of an NRVO-optimized rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Apr 14, 2020
1 parent 4695183 commit 5e6c097
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_mir/transform/dag_nrvo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,17 @@ use rustc_middle::mir::{
};
use rustc_middle::ty::{self, Ty, TyCtxt};
use std::collections::VecDeque;
use rustc_span::def_id::LOCAL_CRATE;

pub struct Nrvo;

impl<'tcx> MirPass<'tcx> for Nrvo {
fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {
if tcx.crate_name(LOCAL_CRATE).as_str().starts_with("rustc_") {
// Only run this pass on the compiler.
return;
}

if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {
return;
}
Expand Down

0 comments on commit 5e6c097

Please sign in to comment.