about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/write.rs
diff options
context:
space:
mode:
authorAugie Fackler <augie@google.com>2024-05-23 14:58:30 -0400
committerAugie Fackler <augie@google.com>2024-05-23 14:58:30 -0400
commitde8200c5a441079cfaadd383a8b6897155bfa2c6 (patch)
tree02bfba609bdfcc97f8e33bcc29ee1eb88e78a7f3 /compiler/rustc_codegen_llvm/src/back/write.rs
parent03d5556ced2d8ce84b9f5da702ac755aa98f7603 (diff)
downloadrust-de8200c5a441079cfaadd383a8b6897155bfa2c6.tar.gz
rust-de8200c5a441079cfaadd383a8b6897155bfa2c6.zip
thinlto: only build summary file if needed
If we don't do this, some versions of LLVM (at least 17, experimentally)
will double-emit some error messages, which is how I noticed this. Given
that it seems to be costing some extra work, let's only request the
summary bitcode production if we'll actually bother writing it down,
otherwise skip it.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 4a24bba2bb7..a0fb110d029 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -716,9 +716,8 @@ pub(crate) unsafe fn codegen(
             let _timer = cgcx
                 .prof
                 .generic_activity_with_arg("LLVM_module_codegen_make_bitcode", &*module.name);
-            let thin = ThinBuffer::new(llmod, config.emit_thin_lto);
+            let thin = ThinBuffer::new(llmod, config.emit_thin_lto, config.emit_thin_lto_index);
             let data = thin.data();
-            let index_data = thin.thin_link_data();
 
             if let Some(bitcode_filename) = bc_out.file_name() {
                 cgcx.prof.artifact_size(
@@ -728,7 +727,8 @@ pub(crate) unsafe fn codegen(
                 );
             }
 
-            if let Some(thin_link_bitcode_filename) = bc_index_out.file_name() {
+            if config.emit_thin_lto_index && let Some(thin_link_bitcode_filename) = bc_index_out.file_name() {
+                let index_data = thin.thin_link_data();
                 cgcx.prof.artifact_size(
                     "llvm_bitcode_summary",
                     thin_link_bitcode_filename.to_string_lossy(),