Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1101121
Remove unused method
bjorn3 Sep 24, 2026
e216dfe
Move some LLVM specific options from Linker::link to cg_llvm
bjorn3 Sep 25, 2026
5a01161
Move incr comp session dirs out of CodegenContext
bjorn3 Sep 24, 2026
5708da5
Improve work product tracking for fat LTO
bjorn3 Jun 3, 2026
980f03b
Add test for incr comp fat LTO and fix assert_module_sources testing
bjorn3 Sep 25, 2026
13035c1
Iterate only once to get module inner attributes position
GuillaumeGomez Sep 30, 2026
52b68f2
Apply suggestion
bjorn3 Sep 30, 2026
9d32c00
bootstrap: Enable rustdoc mergeable CCI for std and internal docs
notriddle Oct 1, 2026
31b8740
Miri can do dirfd now
RalfJung Sep 30, 2026
13b380d
Several small span improvements
nnethercote Oct 1, 2026
29df41c
fix `ValidateBoundVars`
lcnr Oct 1, 2026
b533b26
Add mul_add_relaxed methods for floating-point types
landsharkiest Oct 2, 2026
6d70bb1
bump rustc-build-sysroot
RalfJung Oct 2, 2026
d85a18b
Partially revert previous wrong fix and do some hack instead
ShoyuVanilla Sep 14, 2026
3510be9
Revert "doc: Fix external mention of signum() return value regarding …
Darksonn Oct 2, 2026
5ec3896
Use 'evaluates to' wording
Darksonn Oct 2, 2026
ebdd423
Fix typo
bjorn3 Oct 2, 2026
9270acb
Fix `TypeOutlives` fast-path
ShoyuVanilla Oct 1, 2026
eb4108a
Add mailmap entry
Kobzol Oct 2, 2026
60f8e92
Remove variants from `feature-gate-autodiff-use` test
Kobzol Oct 2, 2026
5a75285
Rollup merge of #163317 - bjorn3:lto_refactors22, r=nnethercote
JonathanBrouwer Oct 2, 2026
8350fd7
Rollup merge of #163582 - notriddle:revert-revert-mergeable-cci, r=Ko…
JonathanBrouwer Oct 2, 2026
3dcef3a
Rollup merge of #151793 - landsharkiest:float_mul_add_relaxed-#151770…
JonathanBrouwer Oct 2, 2026
6e4fa3d
Rollup merge of #162782 - ShoyuVanilla:issue-162557, r=lcnr
JonathanBrouwer Oct 2, 2026
d4bd293
Rollup merge of #163010 - RalfJung:unix-dir-entry, r=Mark-Simulacrum
JonathanBrouwer Oct 2, 2026
be5e4b2
Rollup merge of #163535 - GuillaumeGomez:improve-doc-strings-perf, r=…
JonathanBrouwer Oct 2, 2026
c63bd9e
Rollup merge of #163576 - ShoyuVanilla:outlives-fast-path, r=lcnr
JonathanBrouwer Oct 2, 2026
5cbc19e
Rollup merge of #163587 - nnethercote:small-span-improvements, r=petr…
JonathanBrouwer Oct 2, 2026
76f193c
Rollup merge of #163612 - lcnr:fix-validate-bound-vars, r=oli-obk
JonathanBrouwer Oct 2, 2026
ba060df
Rollup merge of #163632 - RalfJung:miri-build-sysroot, r=oli-obk
JonathanBrouwer Oct 2, 2026
18922f0
Rollup merge of #163635 - Darksonn:signum-nan, r=RalfJung
JonathanBrouwer Oct 2, 2026
a03de78
Rollup merge of #163644 - Kobzol:austin-k-mailmap, r=jieyouxu
JonathanBrouwer Oct 2, 2026
a0dc5bb
Rollup merge of #163651 - Kobzol:feature-autodiff, r=jieyouxu
JonathanBrouwer Oct 2, 2026
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
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Arthur Cohen <arthur.cohen@epita.fr>
Arthur Silva <arthurprs@gmail.com>
Arthur Woimbée <arthur.woimbee@gmail.com>
Artyom Pavlov <newpavlov@gmail.com>
Austin K. <akiekintveld@icloud.com>
Austin Seipp <mad.one@gmail.com> <as@hacks.yi.org>
Ayaz Hafiz <ayaz.hafiz.1@gmail.com>
Aydin Kim <ladinjin@hanmail.net> aydin.kim <aydin.kim@samsung.com>
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3493,9 +3493,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.5.13"
version = "0.5.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "569d545953ee9a1ab9d3e9112e961739ff0cfd50bce06b126937395940be69c9"
checksum = "0d0ed7817483b026efc0492f4ccca177f00fb711537f37943cc412bbf12682b4"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::WorkProduct;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::mono::{MonoItem, MonoItemData, Visibility};
use rustc_session::Session;
use rustc_session::config::{OptLevel, OutputFilenames, OutputType};
use rustc_session::{BorrowedIncrCompSession, Session};
use rustc_span::Symbol;

use crate::base::CodegenedFunction;
Expand Down Expand Up @@ -337,6 +337,7 @@ impl WriteBackendMethods for AotDriver {
fn run_thin_lto(
_cgcx: &CodegenContext,
_prof: &SelfProfilerRef,
_incr_comp_session: Option<&BorrowedIncrCompSession>,
_dcx: rustc_errors::DiagCtxtHandle<'_>,
_exported_symbols_for_lto: &[String],
_each_linked_rlib_for_lto: &[PathBuf],
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ fn fat_lto(
for module in modules {
match module {
FatLtoInput::InMemory(m) => in_memory.push(m),
FatLtoInput::Serialized { name, bitcode_path } => {
info!("pushing serialized module {:?}", name);
FatLtoInput::Serialized { wp, bitcode_path } => {
info!("pushing serialized module {:?}", wp.cgu_name);
serialized_modules.push((
SerializedModule::from_file(&bitcode_path),
CString::new(name).unwrap(),
CString::new(wp.cgu_name).unwrap(),
));
}
}
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{OptLevel, OutputFilenames};
use rustc_session::{CodegenBackendInit, EarlySession, IncrCompSession, Session};
use rustc_session::{
BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session,
};
use rustc_span::{Symbol, sym};
use rustc_target::spec::{RelocModel, TargetTuple};
use tempfile::TempDir;
Expand Down Expand Up @@ -404,6 +406,7 @@ impl WriteBackendMethods for GccCodegenBackend {
fn run_thin_lto(
_cgcx: &CodegenContext,
_prof: &SelfProfilerRef,
_incr_comp_session: Option<&BorrowedIncrCompSession>,
_dcx: DiagCtxtHandle<'_>,
// FIXME(bjorn3): Limit LTO exports to these symbols
_exported_symbols_for_lto: &[String],
Expand Down
44 changes: 31 additions & 13 deletions compiler/rustc_codegen_llvm/src/back/llvm_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
use rustc_session::{CodegenBackendInit, EarlySession, IncrCompSession, Session};
use rustc_session::{
BorrowedIncrCompSession, CodegenBackendInit, EarlySession, IncrCompSession, Session,
};
use rustc_span::{Symbol, sym};
use rustc_target::spec::{RelocModel, TlsModel};

Expand Down Expand Up @@ -120,6 +122,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
fn run_thin_lto(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
exported_symbols_for_lto: &[String],
each_linked_rlib_for_lto: &[PathBuf],
Expand All @@ -128,6 +131,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
back::lto::run_thin(
cgcx,
prof,
incr_comp_session,
dcx,
exported_symbols_for_lto,
each_linked_rlib_for_lto,
Expand Down Expand Up @@ -380,21 +384,35 @@ impl CodegenBackend for LlvmCodegenBackend {
});
}

(compiled_modules, work_products)
}
if sess.codegen_units().as_usize() == 1 && sess.opts.unstable_opts.time_llvm_passes {
let timings =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
print!("{timings}");
}

fn print_pass_timings(&self) {
let timings = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintPassTimings(s) }).unwrap();
print!("{timings}");
}
if sess.print_llvm_stats() {
let stats =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
print!("{stats}");
}

fn print_statistics(&self) {
let stats = llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatistics(s) }).unwrap();
print!("{stats}");
}
if let Some(out_path) = sess.print_llvm_stats_json() {
let llvm_stats_json =
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatisticsJSON(s) }).unwrap();

if !llvm_stats_json.is_empty() {
if let Err(e) = std::fs::write(&out_path, llvm_stats_json) {
sess.dcx().err(format!("failed to write stats to {out_path}: {e}"));
}
} else {
sess.dcx().warn(format!(
"requested to print LLVM statistics to JSON file {out_path}, but the codegen backend \
did not provide any statistics",
));
}
}

fn print_statistics_json(&self) -> String {
llvm::build_string(|s| unsafe { llvm::LLVMRustPrintStatisticsJSON(s) }).unwrap()
(compiled_modules, work_products)
}

fn link(
Expand Down
31 changes: 15 additions & 16 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_errors::{DiagCtxt, DiagCtxtHandle};
use rustc_middle::dep_graph::WorkProduct;
use rustc_session::config;
use rustc_session::{BorrowedIncrCompSession, config};
use rustc_span::bug;
use rustc_structures::SanitizerSet;
use tracing::{debug, info};
Expand Down Expand Up @@ -184,6 +184,7 @@ pub(crate) fn run_fat(
pub(crate) fn run_thin(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
exported_symbols_for_lto: &[String],
each_linked_rlib_for_lto: &[PathBuf],
Expand All @@ -199,7 +200,7 @@ pub(crate) fn run_thin(
is deferred to the linker"
);
}
thin_lto(cgcx, prof, dcx, modules, upstream_modules, &symbols_below_threshold)
thin_lto(prof, incr_comp_session, dcx, modules, upstream_modules, &symbols_below_threshold)
}

fn fat_lto(
Expand All @@ -225,11 +226,11 @@ fn fat_lto(
for module in modules {
match module {
FatLtoInput::InMemory(m) => in_memory.push(m),
FatLtoInput::Serialized { name, bitcode_path } => {
info!("pushing serialized module {:?}", name);
FatLtoInput::Serialized { wp, bitcode_path } => {
info!("pushing serialized module {:?}", wp.cgu_name);
serialized_modules.push((
SerializedModule::from_file(&bitcode_path),
CString::new(name).unwrap(),
CString::new(wp.cgu_name).unwrap(),
));
}
}
Expand Down Expand Up @@ -371,8 +372,8 @@ fn fat_lto(
/// all of the `LtoModuleCodegen` units returned below and destroyed once
/// they all go out of scope.
fn thin_lto(
cgcx: &CodegenContext,
prof: &SelfProfilerRef,
incr_comp_session: Option<&BorrowedIncrCompSession>,
dcx: DiagCtxtHandle<'_>,
modules: Vec<ThinLtoInput<LlvmCodegenBackend>>,
serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
Expand Down Expand Up @@ -400,7 +401,7 @@ fn thin_lto(

for (i, module) in modules.into_iter().enumerate() {
let (name, buffer) = match module {
ThinLtoInput::Red { name, buffer } => (name, buffer),
ThinLtoInput::Red { wp, buffer } => (wp.cgu_name, buffer),
ThinLtoInput::Green { wp, bitcode_path } => {
(wp.cgu_name, SerializedModule::from_file(&bitcode_path))
}
Expand Down Expand Up @@ -463,13 +464,12 @@ fn thin_lto(

info!("thin LTO data created");

let new_key_map_path = cgcx
.new_incr_comp_session_dir
.as_ref()
.map(|dir| dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME));
let new_key_map_path = incr_comp_session.as_ref().map(|incr_comp_session| {
incr_comp_session.new_session_directory.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME)
});

let prev_key_map = if let Some(ref old_incr_comp_session_dir) =
cgcx.old_incr_comp_session_dir
let prev_key_map = if let Some(ref old_incr_comp_session_dir) = incr_comp_session
.and_then(|incr_comp_session| incr_comp_session.old_session_directory.as_deref())
{
let old_path = old_incr_comp_session_dir.join(THIN_LTO_KEYS_INCR_COMP_FILE_NAME);

Expand All @@ -481,7 +481,7 @@ fn thin_lto(
assert!(green_modules.is_empty());
None
};
let curr_key_map = if cgcx.new_incr_comp_session_dir.is_some() {
let curr_key_map = if incr_comp_session.is_some() {
ThinLTOKeysMap::from_thin_lto_modules(&data, &thin_modules, &module_names)
} else {
assert!(green_modules.is_empty());
Expand All @@ -506,8 +506,7 @@ fn thin_lto(
if let (Some(prev_key_map), true) =
(prev_key_map.as_ref(), green_modules.contains_key(module_name))
{
assert!(cgcx.old_incr_comp_session_dir.is_some());
assert!(cgcx.new_incr_comp_session_dir.is_some());
assert!(incr_comp_session.unwrap().old_session_directory.is_some());

// If a module exists in both the current and the previous session,
// and has the same LTO cache key in both sessions, then we can re-use it
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<'tcx> AssertModuleSource<'tcx> {

if !self.check_config(cfg) {
debug!("check_attr: config does not match, ignoring attr");
return;
continue;
}

let user_path = module.as_str();
Expand Down
Loading
Loading