Skip to content

Commit f2933b3

Browse files
committed
Remove want_summary argument from prepare_thin
It is always false nowadays. ThinLTO summary writing is instead done by llvm_optimize.
1 parent e3d0b7d commit f2933b3

File tree

9 files changed

+16
-37
lines changed

9 files changed

+16
-37
lines changed

compiler/rustc_codegen_gcc/src/back/lto.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,9 @@ pub(crate) fn run_thin(
305305
)
306306
}
307307

308-
pub(crate) fn prepare_thin(
309-
module: ModuleCodegen<GccContext>,
310-
_emit_summary: bool,
311-
) -> (String, ThinBuffer) {
308+
pub(crate) fn prepare_thin(module: ModuleCodegen<GccContext>) -> (String, ThinBuffer) {
312309
let name = module.name;
313-
//let buffer = ThinBuffer::new(module.module_llvm.context, true, emit_summary);
310+
//let buffer = ThinBuffer::new(module.module_llvm.context, true);
314311
let buffer = ThinBuffer::new(&module.module_llvm.context);
315312
(name, buffer)
316313
}

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,8 @@ impl WriteBackendMethods for GccCodegenBackend {
408408
back::write::codegen(cgcx, module, config)
409409
}
410410

411-
fn prepare_thin(
412-
module: ModuleCodegen<Self::Module>,
413-
emit_summary: bool,
414-
) -> (String, Self::ThinBuffer) {
415-
back::lto::prepare_thin(module, emit_summary)
411+
fn prepare_thin(module: ModuleCodegen<Self::Module>) -> (String, Self::ThinBuffer) {
412+
back::lto::prepare_thin(module)
416413
}
417414

418415
fn serialize_module(_module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer) {

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,9 @@ pub(crate) fn run_thin(
185185
thin_lto(cgcx, dcx, modules, upstream_modules, cached_modules, &symbols_below_threshold)
186186
}
187187

188-
pub(crate) fn prepare_thin(
189-
module: ModuleCodegen<ModuleLlvm>,
190-
emit_summary: bool,
191-
) -> (String, ThinBuffer) {
188+
pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBuffer) {
192189
let name = module.name;
193-
let buffer = ThinBuffer::new(module.module_llvm.llmod(), true, emit_summary);
190+
let buffer = ThinBuffer::new(module.module_llvm.llmod(), true);
194191
(name, buffer)
195192
}
196193

@@ -687,9 +684,9 @@ unsafe impl Send for ThinBuffer {}
687684
unsafe impl Sync for ThinBuffer {}
688685

689686
impl ThinBuffer {
690-
pub(crate) fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
687+
pub(crate) fn new(m: &llvm::Module, is_thin: bool) -> ThinBuffer {
691688
unsafe {
692-
let buffer = llvm::LLVMRustThinLTOBufferCreate(m, is_thin, emit_summary);
689+
let buffer = llvm::LLVMRustThinLTOBufferCreate(m, is_thin);
693690
ThinBuffer(buffer)
694691
}
695692
}

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ pub(crate) fn codegen(
837837
"LLVM_module_codegen_make_bitcode",
838838
&*module.name,
839839
);
840-
ThinBuffer::new(llmod, config.emit_thin_lto, false)
840+
ThinBuffer::new(llmod, config.emit_thin_lto)
841841
};
842842
let data = thin.data();
843843
let _timer = cgcx

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,8 @@ impl WriteBackendMethods for LlvmCodegenBackend {
211211
) -> CompiledModule {
212212
back::write::codegen(cgcx, module, config)
213213
}
214-
fn prepare_thin(
215-
module: ModuleCodegen<Self::Module>,
216-
emit_summary: bool,
217-
) -> (String, Self::ThinBuffer) {
218-
back::lto::prepare_thin(module, emit_summary)
214+
fn prepare_thin(module: ModuleCodegen<Self::Module>) -> (String, Self::ThinBuffer) {
215+
back::lto::prepare_thin(module)
219216
}
220217
fn serialize_module(module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer) {
221218
(module.name, back::lto::ModuleBuffer::new(module.module_llvm.llmod()))

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,6 @@ unsafe extern "C" {
26022602
pub(crate) fn LLVMRustThinLTOBufferCreate(
26032603
M: &Module,
26042604
is_thin: bool,
2605-
emit_summary: bool,
26062605
) -> &'static mut ThinLTOBuffer;
26072606
pub(crate) fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
26082607
pub(crate) fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
862862
WorkItemResult::Finished(module)
863863
}
864864
ComputedLtoType::Thin => {
865-
let (name, thin_buffer) = B::prepare_thin(module, false);
865+
let (name, thin_buffer) = B::prepare_thin(module);
866866
if let Some(path) = bitcode {
867867
fs::write(&path, thin_buffer.data()).unwrap_or_else(|e| {
868868
panic!("Error writing pre-lto-bitcode file `{}`: {}", path.display(), e);

compiler/rustc_codegen_ssa/src/traits/write.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ pub trait WriteBackendMethods: Clone + 'static {
5050
module: ModuleCodegen<Self::Module>,
5151
config: &ModuleConfig,
5252
) -> CompiledModule;
53-
fn prepare_thin(
54-
module: ModuleCodegen<Self::Module>,
55-
want_summary: bool,
56-
) -> (String, Self::ThinBuffer);
53+
fn prepare_thin(module: ModuleCodegen<Self::Module>) -> (String, Self::ThinBuffer);
5754
fn serialize_module(module: ModuleCodegen<Self::Module>) -> (String, Self::ModuleBuffer);
5855
}
5956

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,12 +1568,11 @@ extern "C" bool LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data,
15681568
return true;
15691569
}
15701570

1571-
extern "C" LLVMRustThinLTOBuffer *
1572-
LLVMRustThinLTOBufferCreate(LLVMModuleRef M, bool is_thin, bool emit_summary) {
1571+
extern "C" LLVMRustThinLTOBuffer *LLVMRustThinLTOBufferCreate(LLVMModuleRef M,
1572+
bool is_thin) {
15731573
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
15741574
{
15751575
auto OS = raw_string_ostream(Ret->data);
1576-
auto ThinLinkOS = raw_string_ostream(Ret->thin_link_data);
15771576
{
15781577
if (is_thin) {
15791578
PassBuilder PB;
@@ -1587,11 +1586,7 @@ LLVMRustThinLTOBufferCreate(LLVMModuleRef M, bool is_thin, bool emit_summary) {
15871586
PB.registerLoopAnalyses(LAM);
15881587
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
15891588
ModulePassManager MPM;
1590-
// We only pass ThinLinkOS to be filled in if we want the summary,
1591-
// because otherwise LLVM does extra work and may double-emit some
1592-
// errors or warnings.
1593-
MPM.addPass(
1594-
ThinLTOBitcodeWriterPass(OS, emit_summary ? &ThinLinkOS : nullptr));
1589+
MPM.addPass(ThinLTOBitcodeWriterPass(OS, nullptr));
15951590
MPM.run(*unwrap(M), MAM);
15961591
} else {
15971592
WriteBitcodeToFile(*unwrap(M), OS);

0 commit comments

Comments
 (0)