Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetadataOnlyCodegenBackend: run the collector only once #57418

Merged
merged 2 commits into from
Jan 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 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,25 +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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to anybody looking through this: collect_and_partition_mono_items query does this assert internally.

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() {
let _ = inst.def.is_inline(tcx);
if def_id.is_local() {
let _ = tcx.codegen_fn_attrs(def_id);
}
}
Expand Down