Run a single huge par_body_owners
instead of many small ones after each other.
This improves parallel rustc parallelism by avoiding the bottleneck after each individual `par_body_owners` (because it needs to wait for queries to finish, so if there is one long running one, a lot of cores will be idle while waiting for the single query).
This commit is contained in:
parent
e2e751e76d
commit
55ea94402b
24 changed files with 265 additions and 275 deletions
|
@ -736,17 +736,20 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
|||
// passes are timed inside typeck
|
||||
rustc_hir_analysis::check_crate(tcx);
|
||||
|
||||
sess.time("MIR_borrow_checking", || {
|
||||
sess.time("typeck_and_mir_analyses", || {
|
||||
tcx.hir().par_body_owners(|def_id| {
|
||||
let def_kind = tcx.def_kind(def_id);
|
||||
// FIXME: Remove this when we implement creating `DefId`s
|
||||
// for anon constants during their parents' typeck.
|
||||
// Typeck all body owners in parallel will produce queries
|
||||
// cycle errors because it may typeck on anon constants directly.
|
||||
if !matches!(def_kind, rustc_hir::def::DefKind::AnonConst) {
|
||||
tcx.ensure().typeck(def_id);
|
||||
}
|
||||
// Run unsafety check because it's responsible for stealing and
|
||||
// deallocating THIR.
|
||||
tcx.ensure().check_unsafety(def_id);
|
||||
tcx.ensure().mir_borrowck(def_id)
|
||||
});
|
||||
});
|
||||
|
||||
sess.time("MIR_effect_checking", || {
|
||||
for def_id in tcx.hir().body_owners() {
|
||||
tcx.ensure().mir_borrowck(def_id);
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
rustc_mir_transform::check_unsafety::check_unsafety(tcx, def_id);
|
||||
}
|
||||
|
@ -761,15 +764,15 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
|||
tcx.ensure().mir_drops_elaborated_and_const_checked(def_id);
|
||||
tcx.ensure().unused_generic_params(ty::InstanceDef::Item(def_id.to_def_id()));
|
||||
}
|
||||
}
|
||||
|
||||
if tcx.is_coroutine(def_id.to_def_id()) {
|
||||
tcx.ensure().mir_coroutine_witnesses(def_id);
|
||||
tcx.ensure().check_coroutine_obligations(def_id);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
tcx.hir().par_body_owners(|def_id| {
|
||||
if tcx.is_coroutine(def_id.to_def_id()) {
|
||||
tcx.ensure().mir_coroutine_witnesses(def_id);
|
||||
tcx.ensure().check_coroutine_obligations(def_id);
|
||||
}
|
||||
});
|
||||
tcx.ensure().check_unused_traits(());
|
||||
|
||||
sess.time("layout_testing", || layout_test::test_layout(tcx));
|
||||
sess.time("abi_testing", || abi_test::test_abi(tcx));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue