about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
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_ssa
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_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs10
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/builder.rs2
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index f6c41af41b4..a87daa8d6b8 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -166,7 +166,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
                 bx.invoke(fn_ty, fn_ptr, &llargs, ret_llbb, unwind_block, self.funclet(fx));
             bx.apply_attrs_callsite(&fn_abi, invokeret);
             if fx.mir[self.bb].is_cleanup {
-                bx.apply_attrs_to_cleanup_callsite(invokeret);
+                bx.do_not_inline(invokeret);
             }
 
             if let Some((ret_dest, target)) = destination {
@@ -178,7 +178,11 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
             let llret = bx.call(fn_ty, fn_ptr, &llargs, self.funclet(fx));
             bx.apply_attrs_callsite(&fn_abi, llret);
             if fx.mir[self.bb].is_cleanup {
-                bx.apply_attrs_to_cleanup_callsite(llret);
+                // Cleanup is always the cold path. Don't inline
+                // drop glue. Also, when there is a deeply-nested
+                // struct, there are "symmetry" issues that cause
+                // exponential inlining - see issue #41696.
+                bx.do_not_inline(llret);
             }
 
             if let Some((ret_dest, target)) = destination {
@@ -1444,7 +1448,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
 
             let llret = bx.call(fn_ty, fn_ptr, &[], None);
             bx.apply_attrs_callsite(&fn_abi, llret);
-            bx.apply_attrs_to_cleanup_callsite(llret);
+            bx.do_not_inline(llret);
 
             bx.unreachable();
 
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs
index 1c7fe060ea4..37f2bfd3c4f 100644
--- a/compiler/rustc_codegen_ssa/src/traits/builder.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs
@@ -479,5 +479,5 @@ pub trait BuilderMethods<'a, 'tcx>:
     ) -> Self::Value;
     fn zext(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
 
-    fn apply_attrs_to_cleanup_callsite(&mut self, llret: Self::Value);
+    fn do_not_inline(&mut self, llret: Self::Value);
 }