From a57d3e86eb277f5d1c5cfc64f81428461b9c5f12 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Mon, 11 Mar 2024 11:03:04 -0700 Subject: [PATCH] Don't inline methods with the DoesNotReturn attribute in interp, it's a waste of time to do so --- src/mono/mono/mini/interp/transform.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 96564d986bca9..a007007dfe290 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -2867,6 +2867,14 @@ interp_method_check_inlining (TransformData *td, MonoMethod *method, MonoMethodS if (td->prof_coverage) return FALSE; + /* + * doesnotreturn methods are not profitable to inline, since they almost certainly will not + * actually run during normal execution, and if they do they will only run once, so the + * upside to inlining them is effectively zero, and we'd waste time doing the inline + */ + if (has_doesnotreturn_attribute (method)) + return FALSE; + if (!is_metadata_update_disabled () && mono_metadata_update_no_inline (td->method, method)) return FALSE;