Skip to content

Commit 431a890

Browse files
Rollup merge of rust-lang#129981 - nnethercote:rm-serialize_bitcode, r=antoyo,tmiasko
Remove `serialized_bitcode` from `LtoModuleCodegen`. It's unused. r? `@bjorn3`
2 parents b0a7fa8 + bbe28cf commit 431a890

File tree

3 files changed

+7
-17
lines changed
  • compiler
    • rustc_codegen_gcc/src/back
    • rustc_codegen_llvm/src/back
    • rustc_codegen_ssa/src/back

3 files changed

+7
-17
lines changed

compiler/rustc_codegen_gcc/src/back/lto.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ fn fat_lto(
272272
}*/
273273
}
274274
};
275-
let mut serialized_bitcode = Vec::new();
276275
{
277276
info!("using {:?} as a base module", module.name);
278277

@@ -317,7 +316,6 @@ fn fat_lto(
317316
unimplemented!("from uncompressed file")
318317
}
319318
}
320-
serialized_bitcode.push(bc_decoded);
321319
}
322320
save_temp_bitcode(cgcx, &module, "lto.input");
323321

@@ -337,7 +335,7 @@ fn fat_lto(
337335
// of now.
338336
module.module_llvm.temp_dir = Some(tmp_path);
339337

340-
Ok(LtoModuleCodegen::Fat { module, _serialized_bitcode: serialized_bitcode })
338+
Ok(LtoModuleCodegen::Fat(module))
341339
}
342340

343341
pub struct ModuleBuffer(PathBuf);

compiler/rustc_codegen_llvm/src/back/lto.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ fn fat_lto(
314314
}
315315
}
316316
};
317-
let mut serialized_bitcode = Vec::new();
318317
{
319318
let (llcx, llmod) = {
320319
let llvm = &module.module_llvm;
@@ -342,9 +341,7 @@ fn fat_lto(
342341
serialized_modules.sort_by(|module1, module2| module1.1.cmp(&module2.1));
343342

344343
// For all serialized bitcode files we parse them and link them in as we did
345-
// above, this is all mostly handled in C++. Like above, though, we don't
346-
// know much about the memory management here so we err on the side of being
347-
// save and persist everything with the original module.
344+
// above, this is all mostly handled in C++.
348345
let mut linker = Linker::new(llmod);
349346
for (bc_decoded, name) in serialized_modules {
350347
let _timer = cgcx
@@ -355,7 +352,6 @@ fn fat_lto(
355352
info!("linking {:?}", name);
356353
let data = bc_decoded.data();
357354
linker.add(data).map_err(|()| write::llvm_err(dcx, LlvmError::LoadBitcode { name }))?;
358-
serialized_bitcode.push(bc_decoded);
359355
}
360356
drop(linker);
361357
save_temp_bitcode(cgcx, &module, "lto.input");
@@ -372,7 +368,7 @@ fn fat_lto(
372368
}
373369
}
374370

375-
Ok(LtoModuleCodegen::Fat { module, _serialized_bitcode: serialized_bitcode })
371+
Ok(LtoModuleCodegen::Fat(module))
376372
}
377373

378374
pub(crate) struct Linker<'a>(&'a mut llvm::Linker<'a>);

compiler/rustc_codegen_ssa/src/back/lto.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,14 @@ pub struct ThinShared<B: WriteBackendMethods> {
4141
}
4242

4343
pub enum LtoModuleCodegen<B: WriteBackendMethods> {
44-
Fat {
45-
module: ModuleCodegen<B::Module>,
46-
_serialized_bitcode: Vec<SerializedModule<B::ModuleBuffer>>,
47-
},
48-
44+
Fat(ModuleCodegen<B::Module>),
4945
Thin(ThinModule<B>),
5046
}
5147

5248
impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
5349
pub fn name(&self) -> &str {
5450
match *self {
55-
LtoModuleCodegen::Fat { .. } => "everything",
51+
LtoModuleCodegen::Fat(_) => "everything",
5652
LtoModuleCodegen::Thin(ref m) => m.name(),
5753
}
5854
}
@@ -68,7 +64,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
6864
cgcx: &CodegenContext<B>,
6965
) -> Result<ModuleCodegen<B::Module>, FatalError> {
7066
match self {
71-
LtoModuleCodegen::Fat { mut module, .. } => {
67+
LtoModuleCodegen::Fat(mut module) => {
7268
B::optimize_fat(cgcx, &mut module)?;
7369
Ok(module)
7470
}
@@ -81,7 +77,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
8177
pub fn cost(&self) -> u64 {
8278
match *self {
8379
// Only one module with fat LTO, so the cost doesn't matter.
84-
LtoModuleCodegen::Fat { .. } => 0,
80+
LtoModuleCodegen::Fat(_) => 0,
8581
LtoModuleCodegen::Thin(ref m) => m.cost(),
8682
}
8783
}

0 commit comments

Comments
 (0)