Skip to content

Commit 5e6c097

Browse files
[perf] test perf of an NRVO-optimized rustc
1 parent 4695183 commit 5e6c097

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustc_mir/transform/dag_nrvo.rs

+6
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,17 @@ use rustc_middle::mir::{
120120
};
121121
use rustc_middle::ty::{self, Ty, TyCtxt};
122122
use std::collections::VecDeque;
123+
use rustc_span::def_id::LOCAL_CRATE;
123124

124125
pub struct Nrvo;
125126

126127
impl<'tcx> MirPass<'tcx> for Nrvo {
127128
fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut BodyAndCache<'tcx>) {
129+
if tcx.crate_name(LOCAL_CRATE).as_str().starts_with("rustc_") {
130+
// Only run this pass on the compiler.
131+
return;
132+
}
133+
128134
if tcx.sess.opts.debugging_opts.mir_opt_level == 0 {
129135
return;
130136
}

0 commit comments

Comments
 (0)