Skip to content

Commit

Permalink
Remove an LTO dependent cgu_reuse_tracker.set_actual_reuse call
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 30, 2023
1 parent 4d4519a commit d8d47ae
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use rustc_hir::def_id::LOCAL_CRATE;
use rustc_middle::bug;
use rustc_middle::dep_graph::WorkProduct;
use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
use rustc_session::cgu_reuse_tracker::CguReuse;
use rustc_session::config::{self, CrateType, Lto};

use std::ffi::{CStr, CString};
Expand Down Expand Up @@ -584,7 +583,6 @@ fn thin_lto(
copy_jobs.push(work_product);
info!(" - {}: re-used", module_name);
assert!(cgcx.incr_comp_session_dir.is_some());
cgcx.cgu_reuse_tracker.set_actual_reuse(module_name, CguReuse::PostLto);
continue;
}
}
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::exported_symbols::SymbolExportInfo;
use rustc_middle::ty::TyCtxt;
use rustc_session::cgu_reuse_tracker::CguReuseTracker;
use rustc_session::config::{self, CrateType, Lto, OutFileName, OutputFilenames, OutputType};
use rustc_session::config::{Passes, SwitchWithOptPath};
use rustc_session::Session;
Expand Down Expand Up @@ -366,8 +365,6 @@ pub struct CodegenContext<B: WriteBackendMethods> {
/// The incremental compilation session directory, or None if we are not
/// compiling incrementally
pub incr_comp_session_dir: Option<PathBuf>,
/// Used to update CGU re-use information during the thinlto phase.
pub cgu_reuse_tracker: CguReuseTracker,
/// Channel back to the main control thread to send messages to
pub coordinator_send: Sender<Box<dyn Any + Send>>,
}
Expand Down Expand Up @@ -1119,7 +1116,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
remark: sess.opts.cg.remark.clone(),
remark_dir,
incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()),
cgu_reuse_tracker: sess.cgu_reuse_tracker.clone(),
coordinator_send,
expanded_args: tcx.sess.expanded_args.clone(),
diag_emitter: shared_emitter.clone(),
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_session/src/cgu_reuse_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ impl CguReuseTracker {
debug!("set_actual_reuse({cgu_name:?}, {kind:?})");

let prev_reuse = data.lock().unwrap().actual_reuse.insert(cgu_name.to_string(), kind);

if let Some(prev_reuse) = prev_reuse {
// The only time it is legal to overwrite reuse state is when
// we discover during ThinLTO that we can actually reuse the
// post-LTO version of a CGU.
assert_eq!(prev_reuse, CguReuse::PreLto);
}
assert!(prev_reuse.is_none());
}
}

Expand Down

0 comments on commit d8d47ae

Please sign in to comment.