Skip to content

Commit

Permalink
Codegen: run the collector only once
Browse files Browse the repository at this point in the history
Use the `collect_and_partition_mono_items ` query to avoid calling the collector
  • Loading branch information
lqd committed Jan 7, 2019
1 parent 21ac19d commit c075e24
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/librustc_codegen_utils/codegen_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ use rustc::middle::cstore::EncodedMetadata;
use rustc::middle::cstore::MetadataLoader;
use rustc::dep_graph::DepGraph;
use rustc_target::spec::Target;
use rustc_mir::monomorphize::collector;
use link::out_filename;

pub use rustc_data_structures::sync::MetadataRef;
Expand Down Expand Up @@ -136,24 +135,15 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
::symbol_names_test::report_symbol_names(tcx);
::rustc_incremental::assert_dep_graph(tcx);
::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
::rustc_mir::monomorphize::assert_symbols_are_distinct(tcx,
collector::collect_crate_mono_items(
tcx,
collector::MonoItemCollectionMode::Eager
).0.iter()
);
// FIXME: Fix this
// ::rustc::middle::dependency_format::calculate(tcx);
let _ = tcx.link_args(LOCAL_CRATE);
let _ = tcx.native_libraries(LOCAL_CRATE);
for mono_item in
collector::collect_crate_mono_items(
tcx,
collector::MonoItemCollectionMode::Eager
).0 {
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
for (mono_item, _) in cgus.iter().flat_map(|cgu| cgu.items().iter()) {
if let MonoItem::Fn(inst) = mono_item {
let def_id = inst.def_id();
if def_id.is_local() {
if def_id.is_local() {
let _ = inst.def.is_inline(tcx);
let _ = tcx.codegen_fn_attrs(def_id);
}
Expand Down

0 comments on commit c075e24

Please sign in to comment.