Skip to content

Commit af8efe2

Browse files
Rollup merge of #155036 - bjorn3:lto_refactors16, r=TaKO8Ki
Store a PathBuf rather than SerializedModule for cached modules In cg_gcc `ModuleBuffer` already only contains a path anyway. And for moving LTO into `-Zlink-only` we will need to serialize `MaybeLtoModules`. By storing a path cached modules we avoid writing them to the disk a second time during serialization of `MaybeLtoModules`. Some further improvements will require changes to cg_gcc that I would prefer landing in the cg_gcc repo to actually test the LTO changes in CI. Part of rust-lang/compiler-team#908
2 parents d10ab82 + da0c871 commit af8efe2

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/back/lto.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,12 @@ fn fat_lto(
144144
for module in modules {
145145
match module {
146146
FatLtoInput::InMemory(m) => in_memory.push(m),
147-
FatLtoInput::Serialized { name, buffer } => {
147+
FatLtoInput::Serialized { name, bitcode_path } => {
148148
info!("pushing serialized module {:?}", name);
149-
serialized_modules.push((buffer, CString::new(name).unwrap()));
149+
serialized_modules.push((
150+
SerializedModule::from_file(&bitcode_path),
151+
CString::new(name).unwrap(),
152+
));
150153
}
151154
}
152155
}

0 commit comments

Comments
 (0)