Rollup merge of #64344 - eddyb:mir-opt-stop-shouting-at-the-kernel, r=oli-obk

rustc_mir: buffer -Zdump-mir output instead of pestering the kernel constantly.

This brings `mir-opt` tests from `197s` (over 3 minutes!) to `2.85s`, on my build server.
That's a nice speedup of about `69x` and so it definitely fixes #58485, for me.

It's such a beginner mistake I feel like maybe `clippy` should lint against it?
(cc @Manishearth @oli-obk)
This commit is contained in:
Mazdak Farrokhzad 2019-09-10 17:19:31 +02:00 committed by GitHub
commit 8d2ef194a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -227,12 +227,12 @@ pub(crate) fn create_dump_file(
pass_name: &str,
disambiguator: &dyn Display,
source: MirSource<'tcx>,
) -> io::Result<fs::File> {
) -> io::Result<io::BufWriter<fs::File>> {
let file_path = dump_path(tcx, extension, pass_num, pass_name, disambiguator, source);
if let Some(parent) = file_path.parent() {
fs::create_dir_all(parent)?;
}
fs::File::create(&file_path)
Ok(io::BufWriter::new(fs::File::create(&file_path)?))
}
/// Write out a human-readable textual representation for the given MIR.