about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_trans/mir/block.rs7
-rw-r--r--src/test/run-pass/issue-41696.rs2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs
index 4926485a121..8863c7ffae6 100644
--- a/src/librustc_trans/mir/block.rs
+++ b/src/librustc_trans/mir/block.rs
@@ -146,6 +146,13 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
             } else {
                 let llret = bcx.call(fn_ptr, &llargs, cleanup_bundle);
                 fn_ty.apply_attrs_callsite(llret);
+                if this.mir[bb].is_cleanup {
+                    // 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.
+                    llvm::Attribute::NoInline.apply_callsite(llvm::AttributePlace::Function, llret);
+                }
 
                 if let Some((ret_dest, ret_ty, target)) = destination {
                     let op = OperandRef {
diff --git a/src/test/run-pass/issue-41696.rs b/src/test/run-pass/issue-41696.rs
index 40fbf5ba75c..1888be58c57 100644
--- a/src/test/run-pass/issue-41696.rs
+++ b/src/test/run-pass/issue-41696.rs
@@ -9,8 +9,6 @@
 // except according to those terms.
 
 // this used to cause exponential code-size blowup during LLVM passes.
-// ignore-test FIXME #41696
-// min-llvm-version 3.9
 
 #![feature(test)]