about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-05 11:23:26 +0000
committerbors <bors@rust-lang.org>2019-12-05 11:23:26 +0000
commit1e2a73867d9c0732c89da8de19d4f18a6e80dcfe (patch)
tree7beaee1e6aa73a6372367666c0066d03946f424e /src/librustc_codegen_llvm
parentd825e35ee8325146e6c175a4c61bcb645b347d5e (diff)
parent85df207ecc3a7b8b7150e2b65c67eec3a23b7c81 (diff)
downloadrust-1e2a73867d9c0732c89da8de19d4f18a6e80dcfe.tar.gz
rust-1e2a73867d9c0732c89da8de19d4f18a6e80dcfe.zip
Auto merge of #66952 - 0dvictor:print, r=rkruppe
Use Module::print() instead of a PrintModulePass

llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/back/write.rs13
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs3
2 files changed, 6 insertions, 10 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 48bbc130723..a05ba9c78e0 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -588,14 +588,11 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<LlvmCodegenBackend>,
                     cursor.position() as size_t
                 }
 
-                with_codegen(tm, llmod, config.no_builtins, |cpm| {
-                    let result =
-                        llvm::LLVMRustPrintModule(cpm, llmod, out_c.as_ptr(), demangle_callback);
-                    llvm::LLVMDisposePassManager(cpm);
-                    result.into_result().map_err(|()| {
-                        let msg = format!("failed to write LLVM IR to {}", out.display());
-                        llvm_err(diag_handler, &msg)
-                    })
+                let result =
+                    llvm::LLVMRustPrintModule(llmod, out_c.as_ptr(), demangle_callback);
+                result.into_result().map_err(|()| {
+                    let msg = format!("failed to write LLVM IR to {}", out.display());
+                    llvm_err(diag_handler, &msg)
                 })?;
             }
 
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index fd31e65c9d3..5362d180d1b 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1727,8 +1727,7 @@ extern "C" {
                                    Output: *const c_char,
                                    FileType: FileType)
                                    -> LLVMRustResult;
-    pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
-                               M: &'a Module,
+    pub fn LLVMRustPrintModule(M: &'a Module,
                                Output: *const c_char,
                                Demangle: extern fn(*const c_char,
                                                    size_t,