Auto merge of #112617 - lqd:dump-mir-dataflow, r=tmiasko
make mir dataflow graphviz dumps opt-in This should save some MIR traversals and allocations that are not really needed. Small win but noticeable locally. Let's see what LTO/PGO say. r? `@ghost`
This commit is contained in:
commit
c911e08514
1 changed files with 7 additions and 7 deletions
|
@ -287,10 +287,12 @@ where
|
||||||
|
|
||||||
let mut results = Results { analysis, entry_sets, _marker: PhantomData };
|
let mut results = Results { analysis, entry_sets, _marker: PhantomData };
|
||||||
|
|
||||||
let res = write_graphviz_results(tcx, body, &mut results, pass_name);
|
if tcx.sess.opts.unstable_opts.dump_mir_dataflow {
|
||||||
|
let res = write_graphviz_results(tcx, &body, &mut results, pass_name);
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
error!("Failed to write graphviz dataflow results: {}", e);
|
error!("Failed to write graphviz dataflow results: {}", e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
results
|
results
|
||||||
}
|
}
|
||||||
|
@ -299,7 +301,7 @@ where
|
||||||
// Graphviz
|
// Graphviz
|
||||||
|
|
||||||
/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via
|
/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via
|
||||||
/// `rustc_mir` attributes.
|
/// `rustc_mir` attributes and `-Z dump-mir-dataflow`.
|
||||||
fn write_graphviz_results<'tcx, A>(
|
fn write_graphviz_results<'tcx, A>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &mir::Body<'tcx>,
|
body: &mir::Body<'tcx>,
|
||||||
|
@ -328,9 +330,7 @@ where
|
||||||
io::BufWriter::new(fs::File::create(&path)?)
|
io::BufWriter::new(fs::File::create(&path)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
None if tcx.sess.opts.unstable_opts.dump_mir_dataflow
|
None if dump_enabled(tcx, A::NAME, def_id) => {
|
||||||
&& dump_enabled(tcx, A::NAME, def_id) =>
|
|
||||||
{
|
|
||||||
create_dump_file(tcx, ".dot", false, A::NAME, &pass_name.unwrap_or("-----"), body)?
|
create_dump_file(tcx, ".dot", false, A::NAME, &pass_name.unwrap_or("-----"), body)?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue