From eed3619f8d86e39c67fed33a3acf7a1cb72f3c42 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 18 Apr 2019 15:01:10 -0700 Subject: [PATCH 1/2] Use -mergefunc-use-aliases for any LLVM >= 8 --- src/librustc_codegen_llvm/llvm_util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 5fea9c8747e0f..8e3bf553fd9bb 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -61,7 +61,7 @@ unsafe fn configure_llvm(sess: &Session) { if sess.opts.debugging_opts.disable_instrumentation_preinliner { add("-disable-preinline"); } - if llvm::LLVMRustIsRustLLVM() { + if get_major_version() >= 8 { match sess.opts.debugging_opts.merge_functions .unwrap_or(sess.target.target.options.merge_functions) { MergeFunctions::Disabled | From a1099ae73ea0fdd9b82329aaf64a977c44a7595e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 18 Apr 2019 15:28:18 -0700 Subject: [PATCH 2/2] Remove the unused LLVMRustIsRustLLVM --- src/librustc_codegen_llvm/llvm/ffi.rs | 1 - src/rustllvm/RustWrapper.cpp | 8 -------- 2 files changed, 9 deletions(-) diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index f6ee8bec16a5a..f88923fc9f1c5 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -1382,7 +1382,6 @@ extern "C" { pub fn LLVMRustDebugMetadataVersion() -> u32; pub fn LLVMRustVersionMajor() -> u32; pub fn LLVMRustVersionMinor() -> u32; - pub fn LLVMRustIsRustLLVM() -> bool; pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32); diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 437e2d482efd6..66453c08a66ef 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -613,14 +613,6 @@ extern "C" uint32_t LLVMRustVersionMinor() { return LLVM_VERSION_MINOR; } extern "C" uint32_t LLVMRustVersionMajor() { return LLVM_VERSION_MAJOR; } -extern "C" bool LLVMRustIsRustLLVM() { -#ifdef LLVM_RUSTLLVM - return 1; -#else - return 0; -#endif -} - extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *Name, uint32_t Value) { unwrap(M)->addModuleFlag(Module::Warning, Name, Value);