about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-01 08:57:46 +0000
committerbors <bors@rust-lang.org>2022-03-01 08:57:46 +0000
commit4a56cbec59903a830a5fc06c5c81956de4199584 (patch)
tree6365b76a9af58b44aa39e77a49184c946578e4eb /compiler/rustc_codegen_llvm/src
parent6e5a6ffb14fc47051b0a23410c681ad6e4af045f (diff)
parent0c784337494223441d53129688bd777ae8df7992 (diff)
downloadrust-4a56cbec59903a830a5fc06c5c81956de4199584.tar.gz
rust-4a56cbec59903a830a5fc06c5c81956de4199584.zip
Auto merge of #94402 - erikdesjardins:revert-coldland, r=nagisa
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"

Should fix (untested) #94390

Reopens #46515, #87055

r? `@ehuss`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs17
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs2
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs6
3 files changed, 3 insertions, 22 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 77aaa3010f2..6c1d4ce8f3c 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -23,7 +23,6 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
 use rustc_span::Span;
 use rustc_target::abi::{self, call::FnAbi, Align, Size, WrappingRange};
 use rustc_target::spec::{HasTargetSpec, Target};
-use smallvec::SmallVec;
 use std::borrow::Cow;
 use std::ffi::CStr;
 use std::iter;
@@ -1179,19 +1178,9 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
         unsafe { llvm::LLVMBuildZExt(self.llbuilder, val, dest_ty, UNNAMED) }
     }
 
-    fn apply_attrs_to_cleanup_callsite(&mut self, llret: &'ll Value) {
-        let mut attrs = SmallVec::<[_; 2]>::new();
-
-        // Cleanup is always the cold path.
-        attrs.push(llvm::AttributeKind::Cold.create_attr(self.llcx));
-
-        // In LLVM versions with deferred inlining (currently, system LLVM < 14),
-        // inlining drop glue can lead to exponential size blowup, see #41696 and #92110.
-        if !llvm_util::is_rust_llvm() && llvm_util::get_version() < (14, 0, 0) {
-            attrs.push(llvm::AttributeKind::NoInline.create_attr(self.llcx));
-        }
-
-        attributes::apply_to_callsite(llret, llvm::AttributePlace::Function, &attrs);
+    fn do_not_inline(&mut self, llret: &'ll Value) {
+        let noinline = llvm::AttributeKind::NoInline.create_attr(self.llcx);
+        attributes::apply_to_callsite(llret, llvm::AttributePlace::Function, &[noinline]);
     }
 }
 
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 81ae97a80cc..50a9349f46a 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -1933,8 +1933,6 @@ extern "C" {
     pub fn LLVMRustVersionMinor() -> u32;
     pub fn LLVMRustVersionPatch() -> u32;
 
-    pub fn LLVMRustIsRustLLVM() -> bool;
-
     /// Add LLVM module flags.
     ///
     /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index b1c14c7e44b..6c974eb9c0b 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -257,12 +257,6 @@ pub fn get_version() -> (u32, u32, u32) {
     }
 }
 
-/// Returns `true` if this LLVM is Rust's bundled LLVM (and not system LLVM).
-pub fn is_rust_llvm() -> bool {
-    // Can be called without initializing LLVM
-    unsafe { llvm::LLVMRustIsRustLLVM() }
-}
-
 pub fn print_passes() {
     // Can be called without initializing LLVM
     unsafe {