@@ -7,6 +7,7 @@ use std::sync::Arc;
7
7
use std:: thread:: JoinHandle ;
8
8
9
9
use rustc_codegen_ssa:: back:: metadata:: create_compressed_metadata_file;
10
+ use rustc_codegen_ssa:: base:: determine_cgu_reuse;
10
11
use rustc_codegen_ssa:: { CodegenResults , CompiledModule , CrateInfo , ModuleKind } ;
11
12
use rustc_data_structures:: profiling:: SelfProfilerRef ;
12
13
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
@@ -490,32 +491,3 @@ pub(crate) fn run_aot(
490
491
concurrency_limiter,
491
492
} )
492
493
}
493
-
494
- // Adapted from https://github.com/rust-lang/rust/blob/303d8aff6092709edd4dbd35b1c88e9aa40bf6d8/src/librustc_codegen_ssa/base.rs#L922-L953
495
- fn determine_cgu_reuse < ' tcx > ( tcx : TyCtxt < ' tcx > , cgu : & CodegenUnit < ' tcx > ) -> CguReuse {
496
- if !tcx. dep_graph . is_fully_enabled ( ) {
497
- return CguReuse :: No ;
498
- }
499
-
500
- let work_product_id = & cgu. work_product_id ( ) ;
501
- if tcx. dep_graph . previous_work_product ( work_product_id) . is_none ( ) {
502
- // We don't have anything cached for this CGU. This can happen
503
- // if the CGU did not exist in the previous session.
504
- return CguReuse :: No ;
505
- }
506
-
507
- // Try to mark the CGU as green. If it we can do so, it means that nothing
508
- // affecting the LLVM module has changed and we can re-use a cached version.
509
- // If we compile with any kind of LTO, this means we can re-use the bitcode
510
- // of the Pre-LTO stage (possibly also the Post-LTO version but we'll only
511
- // know that later). If we are not doing LTO, there is only one optimized
512
- // version of each module, so we re-use that.
513
- let dep_node = cgu. codegen_dep_node ( tcx) ;
514
- assert ! (
515
- !tcx. dep_graph. dep_node_exists( & dep_node) ,
516
- "CompileCodegenUnit dep-node for CGU `{}` already exists before marking." ,
517
- cgu. name( )
518
- ) ;
519
-
520
- if tcx. try_mark_green ( & dep_node) { CguReuse :: PostLto } else { CguReuse :: No }
521
- }
0 commit comments