From 31ee8b18188c748bf73cce52478c61629ed889cc Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Thu, 10 Mar 2022 17:10:36 -0500 Subject: Reapply: Mark drop calls in landing pads cold instead of noinline Co-authored-by: Max Fan Co-authored-by: Nikita Popov --- compiler/rustc_codegen_llvm/src/builder.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src') diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index ac6d8f84142..057e2759454 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -1225,9 +1225,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { unsafe { llvm::LLVMBuildZExt(self.llbuilder, val, dest_ty, UNNAMED) } } - 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]); + fn apply_attrs_to_cleanup_callsite(&mut self, llret: &'ll Value) { + // Cleanup is always the cold path. + let cold_inline = llvm::AttributeKind::Cold.create_attr(self.llcx); + + attributes::apply_to_callsite(llret, llvm::AttributePlace::Function, &[cold_inline]); } } -- cgit 1.4.1-3-g733a5