Skip to content

Commit cd504f2

Browse files
committed
Remove serialized_bitcode from LtoModuleCodegen.
It's unused.
1 parent d6c8169 commit cd504f2

File tree

3 files changed

+6
-14
lines changed
  • compiler
    • rustc_codegen_gcc/src/back
    • rustc_codegen_llvm/src/back
    • rustc_codegen_ssa/src/back

3 files changed

+6
-14
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

+1-3
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;
@@ -355,7 +354,6 @@ fn fat_lto(
355354
info!("linking {:?}", name);
356355
let data = bc_decoded.data();
357356
linker.add(data).map_err(|()| write::llvm_err(dcx, LlvmError::LoadBitcode { name }))?;
358-
serialized_bitcode.push(bc_decoded);
359357
}
360358
drop(linker);
361359
save_temp_bitcode(cgcx, &module, "lto.input");
@@ -372,7 +370,7 @@ fn fat_lto(
372370
}
373371
}
374372

375-
Ok(LtoModuleCodegen::Fat { module, _serialized_bitcode: serialized_bitcode })
373+
Ok(LtoModuleCodegen::Fat(module))
376374
}
377375

378376
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)