about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-03-21 09:19:21 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2020-03-23 10:45:27 +1100
commita147cd070e4b8824aafc7fa9f20d6fdf34eb3bf9 (patch)
treec3de58c25529bca74ddb3113e261ea44dc5e73e9 /src
parentf8261b496d5c94bd8d6ad5dcce0cb5cc2e0e3fe5 (diff)
downloadrust-a147cd070e4b8824aafc7fa9f20d6fdf34eb3bf9.tar.gz
rust-a147cd070e4b8824aafc7fa9f20d6fdf34eb3bf9.zip
Introduce a local variable `config_emit_normal_obj`.
This adds a missing `!config.obj_is_bitcode` condition to two places
that should have it.

As a result, when `obj_is_bitcode` and `no_integrated_as` are both true,
the compiler will no longer unnecessarily emit asm, convert it to an
object file, and then overwrite that object file with bitcode.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_codegen_llvm/back/write.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 1df8ee6746d..d2d3eb59796 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -732,7 +732,9 @@ pub(crate) unsafe fn codegen(
             })?;
         }
 
-        if config.emit_asm || (config.emit_obj && config.no_integrated_as) {
+        let config_emit_normal_obj = config.emit_obj && !config.obj_is_bitcode;
+
+        if config.emit_asm || (config_emit_normal_obj && config.no_integrated_as) {
             let _timer = cgcx
                 .prof
                 .generic_activity_with_arg("LLVM_module_codegen_emit_asm", &module.name[..]);
@@ -747,7 +749,7 @@ pub(crate) unsafe fn codegen(
             })?;
         }
 
-        if config.emit_obj && !config.obj_is_bitcode && !config.no_integrated_as {
+        if config_emit_normal_obj && !config.no_integrated_as {
             let _timer = cgcx
                 .prof
                 .generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
@@ -761,7 +763,7 @@ pub(crate) unsafe fn codegen(
                     llvm::FileType::ObjectFile,
                 )
             })?;
-        } else if config.emit_obj && config.no_integrated_as {
+        } else if config_emit_normal_obj && config.no_integrated_as {
             let _timer = cgcx
                 .prof
                 .generic_activity_with_arg("LLVM_module_codegen_asm_to_obj", &module.name[..]);