1
Fork 0

Reapply: Mark drop calls in landing pads cold instead of noinline

Co-authored-by: Max Fan <git@max.fan>
Co-authored-by: Nikita Popov <npopov@redhat.com>
This commit is contained in:
Erik Desjardins 2022-03-10 17:10:36 -05:00 committed by Nikita Popov
parent 15783292e5
commit 31ee8b1818
7 changed files with 85 additions and 12 deletions

View file

@ -213,7 +213,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
self.funclet(fx),
);
if fx.mir[self.bb].is_cleanup {
bx.do_not_inline(invokeret);
bx.apply_attrs_to_cleanup_callsite(invokeret);
}
if let Some((ret_dest, target)) = destination {
@ -228,11 +228,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> {
} else {
let llret = bx.call(fn_ty, fn_attrs, Some(&fn_abi), fn_ptr, &llargs, self.funclet(fx));
if fx.mir[self.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.
bx.do_not_inline(llret);
bx.apply_attrs_to_cleanup_callsite(llret);
}
if let Some((ret_dest, target)) = destination {
@ -1627,7 +1623,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
let fn_ty = bx.fn_decl_backend_type(&fn_abi);
let llret = bx.call(fn_ty, None, Some(&fn_abi), fn_ptr, &[], funclet.as_ref());
bx.do_not_inline(llret);
bx.apply_attrs_to_cleanup_callsite(llret);
bx.unreachable();

View file

@ -332,5 +332,5 @@ pub trait BuilderMethods<'a, 'tcx>:
) -> Self::Value;
fn zext(&mut self, val: Self::Value, dest_ty: Self::Type) -> Self::Value;
fn do_not_inline(&mut self, llret: Self::Value);
fn apply_attrs_to_cleanup_callsite(&mut self, llret: Self::Value);
}