Skip to content

Commit 8b8ffa8

Browse files
committed
Merge modules and cached_modules for fat LTO
The modules vec can already contain serialized modules and there is no need to distinguish between cached and non-cached cgus at LTO time.
1 parent 4475b1c commit 8b8ffa8

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/back/lto.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
175175
pub(crate) fn run_fat(
176176
cgcx: &CodegenContext<GccCodegenBackend>,
177177
modules: Vec<FatLtoInput<GccCodegenBackend>>,
178-
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
179178
) -> Result<ModuleCodegen<GccContext>, FatalError> {
180179
let dcx = cgcx.create_dcx();
181180
let dcx = dcx.handle();
@@ -186,7 +185,6 @@ pub(crate) fn run_fat(
186185
cgcx,
187186
dcx,
188187
modules,
189-
cached_modules,
190188
lto_data.upstream_modules,
191189
lto_data.tmp_path,
192190
//&lto_data.symbols_below_threshold,
@@ -197,7 +195,6 @@ fn fat_lto(
197195
cgcx: &CodegenContext<GccCodegenBackend>,
198196
_dcx: DiagCtxtHandle<'_>,
199197
modules: Vec<FatLtoInput<GccCodegenBackend>>,
200-
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
201198
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
202199
tmp_path: TempDir,
203200
//symbols_below_threshold: &[String],
@@ -211,21 +208,12 @@ fn fat_lto(
211208
// modules that are serialized in-memory.
212209
// * `in_memory` contains modules which are already parsed and in-memory,
213210
// such as from multi-CGU builds.
214-
//
215-
// All of `cached_modules` (cached from previous incremental builds) can
216-
// immediately go onto the `serialized_modules` modules list and then we can
217-
// split the `modules` array into these two lists.
218211
let mut in_memory = Vec::new();
219-
serialized_modules.extend(cached_modules.into_iter().map(|(buffer, wp)| {
220-
info!("pushing cached module {:?}", wp.cgu_name);
221-
(buffer, CString::new(wp.cgu_name).unwrap())
222-
}));
223212
for module in modules {
224213
match module {
225214
FatLtoInput::InMemory(m) => in_memory.push(m),
226215
FatLtoInput::Serialized { name, buffer } => {
227216
info!("pushing serialized module {:?}", name);
228-
let buffer = SerializedModule::Local(buffer);
229217
serialized_modules.push((buffer, CString::new(name).unwrap()));
230218
}
231219
}

src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,13 @@ impl WriteBackendMethods for GccCodegenBackend {
359359
fn run_and_optimize_fat_lto(
360360
cgcx: &CodegenContext<Self>,
361361
modules: Vec<FatLtoInput<Self>>,
362-
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
363362
diff_fncs: Vec<AutoDiffItem>,
364363
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
365364
if !diff_fncs.is_empty() {
366365
unimplemented!();
367366
}
368367

369-
back::lto::run_fat(cgcx, modules, cached_modules)
368+
back::lto::run_fat(cgcx, modules)
370369
}
371370

372371
fn run_thin_lto(

0 commit comments

Comments
 (0)