Make misc checking 2 more parallel

This commit is contained in:
John Kåre Alsaker 2019-02-23 18:12:38 +01:00
parent d2923e5a77
commit 1745957d63
7 changed files with 17 additions and 44 deletions

View File

@ -10,12 +10,6 @@ use syntax_pos::Span;
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
use crate::hir;
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
}
}
fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,

View File

@ -185,12 +185,6 @@ fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor());
}
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &module in tcx.hir().krate().modules.keys() {
tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
}
}
pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
check_mod_liveness,

View File

@ -218,24 +218,25 @@ fn analysis<'tcx>(
// passes are timed inside typeck
typeck::check_crate(tcx)?;
time(sess, "misc checking", || {
time(sess, "misc checking 2", || {
parallel!({
time(sess, "rvalue promotion", || {
rvalue_promotion::check_crate(tcx)
time(sess, "rvalue promotion + match checking", || {
tcx.par_body_owners(|def_id| {
tcx.ensure().const_is_rvalue_promotable_to_static(def_id);
tcx.ensure().check_match(def_id);
});
});
}, {
time(sess, "intrinsic checking", || {
middle::intrinsicck::check_crate(tcx)
});
}, {
time(sess, "match checking", || mir::matchck_crate(tcx));
}, {
// this must run before MIR dump, because
// "not all control paths return a value" is reported here.
//
// maybe move the check to a MIR pass?
time(sess, "liveness checking", || {
middle::liveness::check_crate(tcx)
time(sess, "liveness checking + intrinsic checking", || {
par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
// this must run before MIR dump, because
// "not all control paths return a value" is reported here.
//
// maybe move the check to a MIR pass?
tcx.ensure().check_mod_liveness(tcx.hir().local_def_id(module));
tcx.ensure().check_mod_intrinsics(tcx.hir().local_def_id(module));
});
});
});
});
@ -276,7 +277,7 @@ fn analysis<'tcx>(
return Err(ErrorReported);
}
time(sess, "misc checking", || {
time(sess, "misc checking 3", || {
parallel!({
time(sess, "privacy access levels", || {
tcx.ensure().privacy_access_levels(LOCAL_CRATE);

View File

@ -27,13 +27,6 @@ use std::slice;
use syntax::ptr::P;
use syntax_pos::{Span, DUMMY_SP, MultiSpan};
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for def_id in tcx.body_owners() {
tcx.ensure().check_match(def_id);
}
tcx.sess.abort_if_errors();
}
pub(crate) fn check_match<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,

View File

@ -3,7 +3,6 @@
mod _match;
mod check_match;
pub use self::check_match::check_crate;
pub(crate) use self::check_match::check_match;
use crate::const_eval::{const_field, const_variant_index};

View File

@ -54,7 +54,6 @@ pub mod interpret;
pub mod monomorphize;
pub mod const_eval;
pub use hair::pattern::check_crate as matchck_crate;
use rustc::ty::query::Providers;
pub fn provide(providers: &mut Providers<'_>) {

View File

@ -39,13 +39,6 @@ pub fn provide(providers: &mut Providers<'_>) {
};
}
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
for &body_id in &tcx.hir().krate().body_ids {
let def_id = tcx.hir().body_owner_def_id(body_id);
tcx.const_is_rvalue_promotable_to_static(def_id);
}
}
fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId)
-> bool